Select Page

Ruby on Rails is one of the most powerful and productive framerorks all around. The performance is not optimal, some developer may say, but, when it comes to developing time cost, this performance results on less hours coding, less problems and a solid MVC to found the base and organize our app.

If Rails 2 to Rails 3 was a big big jump, Rails 4 is going to be much more conservative. Scheduled to the end of 2012, the main new features are:

  • StrongParameters: replaces attr_accessor, attr_protected, moves param filtering concern to the controller rather than the model.
  • ActiveSupport::Queue: Discussed at RailsConf, add queueing support to Rails, now running tasks on background or in a queue is a lot easier, no gem required (spawn, bye bye).
  • Cache Digests: Rails 4.0 introduces cache key generation based on an item and its dependencies, so nested cache elements properly expire when an item is updated.
  • PATCH verb support: Support of HTTP PATCH method (_method equals “patch”), which will map to your update action is introduced in Rails 4.0.
  • Routing Concern: Rails 4.0 introduces some methods to help clean up your duplicate routes.
  • Improvements to ActiveRecord::Relation
    • Relation.all: returns ActiveRecord::relation object. User.all => User.to_a
    • Relation.none: Returns ActiveRecord::NullRelation, still chainable
    • Relation.___!: mutates current relation, e.g. @users.where!, @users.include!
  • Deprecations
    • AR::Base.scoped
    • Dynamic Finder Methods: e.g. find_all_by_* (why????)
    • Hash-based Finders: e.g. User.find(:first) (nice!)
    • Eager Evaluated Scope: scope will require a lambda
    • ActiveRecord::SessionStore
    • ActiveResource
    • Rails::Plugin
  • New Deprecation Policy: Many of the above deprecations will still work in Rails 4.0 and included as gem dependencies, but will be removed in the jump to Rails 4.1. This means that the upgrade to Rails 4.1 may be more painful than the upgrade to Rails 4.0.

With this on the eye, the health of the rails environment is really good, and it’s a good moment to start developing on this platform, if you’re not yet. The learning curve is a little high from languages like PHP, but it worths the time and effort. Maintenance becomes so much easy and code organization is simply brilliant. Here at obikui, we are on the Rails side. And you? Give it a try!