Ruby On Rails

add news feed

post a story

This article is heavily styled and is best viewed at PeepCode! words and design Geoffrey Grosenbach photography Paula Lavalle The early 2000’s were an exciting time for dynamic...
This article is heavily styled and is best viewed at PeepCode! words and design Geoffrey Grosenbach photography Paula Lavalle The early 2000’s were an exciting time for dynamic programming languages. Excitement was high for the upcoming Perl 6. It ran on a brand new VM built specifically for dynamic languages and included dozens of experimental syntax sugars such as the hyper operator, which could run a calculation on every element of an array (somewhat like map). I attended the Seattle Perl User Group every month where you couldn’t ignore the anticipation! It was during these years that I first heard about a weird language that used indentation to define scope (now known as Python). And on January 1, 2001, Dr. Dobb’s journal published an article by Dave Thomas introducing Ruby to the West. That’s not even counting the other languages I tried out for a few weeks each such as REBOL, RealBasic, and AppleScript. There must be something special about the start of a decade, because I’m feeling that same kind of excitement and seeing that same kind of experimentation again. At the beginning of May we filmed a 2 hour video with Elixir creator José Valim. Elixir is a language that runs on the Erlang VM but is inspired by the syntax and concepts of many other languages including Ruby, Python, and even Lisp. It’s not just a transpiler like CoffeeScript; it makes real Erlang .beam bytecode. According to some, parts of Elixir are even more optimized than Erlang itself. It benefits from all the concurrency and deployment options available to Erlang programs. Elixir can call Erlang functions and vice versa. I don’t pretend to be an Elixir expert (that’s why we worked with José, who is), but I left the session with a lot of enthusiasm for Elixir’s design and features. Here are a few of them. Smart assert A programming language like Ruby loses a lot of data when you run it. It quickly loses access to the original source code. If you write a test with Ruby’s basic assert, it can only tell you that the test passed or that it didn’t; it can’t tell you why. Projects like ruby2ruby have tried to bridge this gap but haven’t had support from the core team. Elixir works directly with your source code to do smart things. Tests rarely need more than the built-in assert, yet meaningful errors can be displayed. Take this Elixir code: test "makes bacon" do assert Bacon.make_bacon() == "avocado" end By reading it, we can see that it’s erroneously making bacon but looking for "avocado". We expect that it will fail. If this were a test in Ruby (or any other language), we would see an error such as expected true, got false. Not too helpful. In Elixir, we see this: ** (ExUnit.ExpectationError) expected: "bacon" to be equal to (==): "avocado" at test/bacon_test.exs:14 Elixir knows that == is being used in the assertion, and shows you the values on either side of == when the test fails. Now that’s a useful error! Multi-block control flow For years I’ve wanted to be able to write my own control flow structures, such as an each...else that runs an else block if the each is empty (Handlebars templates have this). The only way to do that in Ruby would be to pass several lambdas to a method, which would be ugly. In Elixir, the relationship between single line functions and multi-line blocks is well thought out. These two are equivalent: # Single line if(condition, do: a, else: b) # Multiple lines if condition do a else b end In the single line version, if is a function that takes two arguments: the condition and the clauses. T
about 5 hours ago
Very pleased to announce that CommunityRun and the ControlShift platform have won the NSW iAwards in the Community Category. Many thanks to everyone from GetUp, ThoughtWorks and ControlShift labs for all the hard work and perseverance. ...
Very pleased to announce that CommunityRun and the ControlShift platform have won the NSW iAwards in the Community Category. Many thanks to everyone from GetUp, ThoughtWorks and ControlShift labs for all the hard work and perseverance. I'm proud to have been part of the team to build a tool that lets anyone start and run their own campaign to improve things in their community.
about 19 hours ago
We’re pleased to announce Composer support for PHP applications. This has been one of our most requested features, and should make it even easier for you to manage your apps. If you’re already using Composer, you can dive right in. If n...
We’re pleased to announce Composer support for PHP applications. This has been one of our most requested features, and should make it even easier for you to manage your apps. If you’re already using Composer, you can dive right in. If not, now is a great time to try it out. We recommend Composer for all PHP apps! What is Composer? Composer is a popular dependency manager for PHP. With it, you can specify project dependencies in a composer.json file and Composer will automatically handle the rest. For more information about Composer, take a look at the project website. Why is It Useful? Composer allows you to manage third-party dependencies separate from your code, decluttering your repository. What’s more, it makes updating your dependencies a snap. Just run composer update and Composer will fetch the latest compatible versions. How Can I Use It? Using Composer with Engine Yard is very simple. We’ll detect the presence of a composer.lock file in your repository, and automatically install your app’s dependencies. To get started with Composer for Engine Yard, take a look at the documentation. The post Announcing Composer Support appeared first on Engine Yard Developer Blog.
1 day ago
http://youtu.be/djbI2yPhSlQ I spent the first half of yesterday trying to design the user interface a little more using Apple Keynote. It’s…okay. You can form boxes and colors rather quickly with it. The animation sort of works bu...
http://youtu.be/djbI2yPhSlQ I spent the first half of yesterday trying to design the user interface a little more using Apple Keynote. It’s…okay. You can form boxes and colors rather quickly with it. The animation sort of works but because you can’t get a good look at all the animation actions at once and everything happens on mouseclicks, it gets a little complicated. You’re trying tosimulate a fully functional web app on what is essentially power point. It doesn’t help that I’m not that big on mock-ups. I try to get an idea of what I want with the design then do all the nuancing when I’ve expressed everything in code. It’s probably for the best anyway. An app in the hand is worth two in demo, as they say. The last half of yesterday was dedicated to transferring back to postgres. After an hour of wrestling with my local installation, I decided to use sqlite on development since postgres is already fully installed on heroku. There are about 24 failures left for me to deal with, most of them have to do with the specific way mongoid saves records. Once that’s finished, I’ve compiled a list of features for me to implement. These are either features I’ve implemented before, like custom validations, or features that I’ve found railscast episodes to go with. I think the tough part will be creating tests for them in the first place. First of all we are going to make sure events can’t conflict, so you can’t create or accept an invite to an event when you’ve had a previous engagement on the system. Next we’re going to make it so only mutual friendships are allowed, and that you can only invite mutual friends to events. Then there’s the recover password system, beta invite system, community points, profile trust index, game persona system, messaging system, google calendar integration and event check-in system! Not to mention a whole bunch of mailers to make this all work.
1 day ago
It's Rails day as Heroku moves to Ruby 2.0, Rails 2.3's life is lingering, we build Awesome APIs, visit removing Views, cut back on Callbacks, expand our Environments, and tackle Changed Tests on this episode of Ruby5. Listen to this e...
It's Rails day as Heroku moves to Ruby 2.0, Rails 2.3's life is lingering, we build Awesome APIs, visit removing Views, cut back on Callbacks, expand our Environments, and tackle Changed Tests on this episode of Ruby5. Listen to this episode on Ruby5 This episode is sponsored by Heroku Heroku just released their Dashboard Notification Center. On it, you'll get updates and alerts that affect you and your running applications. This includes security vulnerabilities, changes to Heroku default configurations, add-on updates, and more. Heroku is now defaulting to MRI Ruby 2.0 Just yesterday afternoon, Heroku announced that MRI Ruby 2.0 is now the default version of Ruby for all new applications. This does not mean that you must upgrade right away (only Rails 4 officially supports Ruby 2), but it's time to start working your way up the Ruby 1.9 chain and getting ready for the migration. Rails LTS and the Rails 2.3 end of life With the upcoming release of Rails 4, the Rails core team officially drops all support for the Rails 2.3 branch. That means that either you're on your own for security updates, you're relying on the community, or perhaps Makaranda's Rails LTS (long term support) service is for you. It's a commercial fork of Rails to offer longer term framework support. Building Awesome Rails Apis Part 1 Daniel Morrison over at Collective Idea has started a blog series on Building Awesome Rails APIs, and it’s got some good information in it. Part 1 focuses on routing, subdomains, namespacing, versioning, and more. Stubbing Views in Rails Controller Testing A few days ago, Francesco Rodríguez introduced a new gem he’s just released called Blind. Blind is a gem which disables view rendering in your Minitest/Test::Unit Rails controller tests. Beyond the Rails Environments David Henemeier Hansson published a post at 37signals about the multitude of Rails environments they run. They run a total of six Rails environments, ranging from the standard to a beta environment and a 10% rollout environment. The Problem With Rails Callbacks Back in early May, Samuel Mullen wrote up an article entitled “The Problem with Rails Callbacks.” He highlights the issues with relying on callbacks and observers and offers a service-oriented solution. Running Changed Tests Last week, Robert Jackson wrote up a little git trick which allows you to only run those tests on a new git branch which have been modified from the master branch. This could be useful for quickly running only your locally modified tests.
1 day ago
RT @cjoh: My favorite part of the 127 page form you have to fill out to get top secret clearance:
RT @cjoh: My favorite part of the 127 page form you have to fill out to get top secret clearance:
1 day ago
Repository Next - Big redesign from GitHub. I'm not convinced, but perhaps I'm just too old to learn new tricks. Leveling Up on Chef Best Practices - The chef ecosystem is something I really need to learn better one of these days. Secr...
Repository Next - Big redesign from GitHub. I'm not convinced, but perhaps I'm just too old to learn new tricks. Leveling Up on Chef Best Practices - The chef ecosystem is something I really need to learn better one of these days. Secrets of the Browser Developer Tools - Things you can do with Chrome, Firebug, Firefox, Opera, and Safari. If Your Business Uses Rails 2.3 You Need To Move To A Supported Option ASAP - A look at the alternatives for old apps moving forward.
1 day ago
I’ve got a simple mailer working for my app now. I feel like I’m almost getting to the point where I can start deploying, but I’m beginning to realize that I need to crystallize my direction a little here. I’ve got a minimal UI going wit...
I’ve got a simple mailer working for my app now. I feel like I’m almost getting to the point where I can start deploying, but I’m beginning to realize that I need to crystallize my direction a little here. I’ve got a minimal UI going with twitter bootstrap and some code from Mike Hartl’s railstutorial, but I think I need to figure out what I want from the end product a little better. Today I’m going to try and use Apple keynote and gimp to see if I can put together a couple of User Experience stories together. If they’re good enough, maybe I can cut them together for use on my launchrock page. Once that’s done, I’ve decided to make another change in direction. I would like to switch back from MongoDB to Postgres. I know I put a lot of work into making this work with a document based database, but the more I look at the problem I’m trying to solve, the more I realize I need a relational database. How all these individual data rows relate to each other is more important that what is actually in them. This way I can re-establish has-many through relationships. There are a lot of cool things about MongoDB, but I don’t think I’ll be able to use them until the site starts getting large. It might be possible for me to use MongoDB for more high-volume functions later. So for now, I’ll be using a more classic use case for Rails. I won’t give myself more than a day or so to do it, otherwise I’ll be throwing away a perfectly functional system.
2 days ago
Spree has recently updated its documentation regarding contributions and has included (maybe for the first time?) an official Release Policy. This is an important step forward for the Spree community so that developers can communicate to...
Spree has recently updated its documentation regarding contributions and has included (maybe for the first time?) an official Release Policy. This is an important step forward for the Spree community so that developers can communicate to clients the potential costs and benefits when upgrading Spree, understand how well Spree supports older releases, and gauge the overall speed of the "upgrade treadmill". Deprecation Warnings Deprecation warnings are to be added in patch releases (i.e. 2.0.2) and the code being deprecated will only be removed in minor versions. For example, if a deprecation warning is added in 2.0.2, 2.0.3 will still contain the same deprecation warning but in 2.1.0 the deprecation warning and the code will be gone. Deprecation warnings are very helpful for developers, but without a robust test suite exercising your application, it's easy for deprecation warnings to go unnoticed. A strong test suite coupled with deprecation warnings helps you manage your client's expectations about how upgrades can affect your Spree customizations and extensions. Master Branch Receives All Patches Master branch receives all patches, including new features and breaking API changes (with deprecation warnings, if necessary). No surprises here; the master branch is for developers and should not be used for production. If you think you've encountered a bug in Spree, make sure to create a failing test against master to make sure it hasn't be resolved by any existing patches. Read more about filing an issue for additional details. Current Stable Release Branch One branch "back" from master (currently 2-0-stable) receives patches that fix all bugs, and security issues, and modifications for recently added features (for example, split shipments). Breaking API changes should be avoided, but if unavoidable then a deprecation warning MUST be provided before that change takes place. Continuing Spree's history of very aggressive refactoring, breaking API changes are permitted in the current stable branch. If you're looking for a truly stable release of Spree, you'll need to look back two stable branches behind master. Two Releases Behind Master Two branches "back" from master (currently 1-3-stable) receives patches for major and minor issues, and security problems. Absolutely no new features, tweaking or API changes. In my opinion, this is the only branch that should be considered for use in production. With the API locked down and a greater chance of most bugs worked out while it was the current release branch, the "two-back" stable branch is a safe bet that's going to have the most up-to-date feature set. Three and Four Releases Behind Master Three branches back from master (currently 1-2-stable) receives patches for major issues and security problems. The severity of an issue will be determined by the person investigating the issue. Absolutely no features, tweaking or API changes. Four branches and more "back" from master (currently 1-1-stable and lesser) receive patches only for security issues, as people are still using these branches and may not be able to or wish to upgrade to the latest version of Spree. It's nice to see a fairly strong commitment to accepting security patches, although if we look at this in absolute terms, the 1.1.x release was put into security-patches-only mode after just 13 months. Considering that the 1-1-stable branch is 2,127 commits behind the 1-3-stable branch (!!), it's clear that Spree is now formalizing it's very aggressive release culture. Managing the Upgrade Treadmill As stated previously, a strong test suite is the best tool available to be able to determine what upstream updates affect your Spree customizations. Coupled with deprecation warnings, it becomes a fairly straight-forward process for identifying breaking changes, creating estimates for fixes, and communicating these costs to clients. Following the stated guides for customizing Spree is also recommended. When visiting the
2 days ago
Onion Pi - Anonymous browsing anywhere with this portable Tor proxy. Stubbing Views in Rails Controller Testing - Avoid the overhead of rendering views when you don't need them. Returning to Free Software: A Guide - Cutting ties with t...
Onion Pi - Anonymous browsing anywhere with this portable Tor proxy. Stubbing Views in Rails Controller Testing - Avoid the overhead of rendering views when you don't need them. Returning to Free Software: A Guide - Cutting ties with the folks who have cooperated with PRISM. Arproxy - Analyze or modify SQL in between Active Record and your database. RailsMailPreview - Free solution for previewing email from Rails applications on OS X. Docracy Terms of Service Tracker - Adds/edits/deletes across more than a thousand sites.
3 days ago