News for hackers. Stuff that matters.
Re:Michael Hartl announces the Rails Tutorial Vanguard by aarongough on Friday June 11, 2010 @01:04AM (#1422870)
From what I've seen most of the basic knowledge involved in creating a Rails 2.X app translates well for Rails 3. The basic application structure and the way of thinking about the layout of the application remains largely unchanged.

Some highlight differences difference being:

  # ActiveRecord query syntax
  2.X: User.all(:conditions => {:name => "aaron"}, :limit => 1)
  3.X: User.where(:name => "aaron").limit(1)
  
  # ActionMailer API now closely matches the ActionController API
  2.X: 
    class Notifier
      def user_notification(user)
        recipients  user.email
        subject     "test subject"
        from        "[email protected]"
        body        :user => user
      end
    end
    
  3.X:
    class Notifier
      default :from => "[email protected]"
      
      def user_notification(user)
        @user = user
      end
    end   
    
In Rails 3 Gem dependencies are managed using Bundler, which means that you have to explicitly declare all of the gems your application uses, even fundamental things like Rails and Rack. Calls to config.gem need to be removed, and added to a Gemfile instead.

There are quite a few more API changes than what I have listed here, routes in particular will change greatly for complex applications. The full details are here: http://guides.rails.info/3_0_release_notes.html

There are no comments on this comment yet.