3 ms·
One question for Michael or any other rails developers out there: railstutorial.org teaches rails using Rails 2.3.x, but it looks like at least the first batch
by rjett 16y ago
One question for Michael or any other rails developers out there: railstutorial.org teaches rails using Rails 2.3.x, but it looks like at least the first batch of screencasts you're putting out will be about Rails 3. How much of what I just learned by going through Rails Tutorial is going to be obsolete in Rails 3 and if I have already started to develop an app using the techniques discussed in the tutorial, should I stop while I'm not far in and start over with Rails 3 or should I keep on with 2.3.6 and try to transition everything further down the road?
- aarongough 16y agoFrom 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 "system@test.com" body :user => user end end 3.X: class Notifier default :from => "system@test.com" 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 http://guides.rails.info/3_0_release_notes.html
- aarongough 16y agoAlso: I would keep going with the tutorial. It's always good to have the experience of transitioning between versions, and you probably won't appreciate Rails 3 as much if you haven't used 2.X! :-p
- philwelch 16y agoI'm going along with the tutorial myself, except I'm actually doing it in Rails 3 and researching the differences on my own as they crop up. So far, the tutorial actually seems fairly accurate. Differences so far: the tutorial has you use RSpec 1 for testing, but RSpec 2 (prerelease) is required for Rails 3. Also, routing is completely different in Rails 3, which shows up early on (when you create a new static page without autogenerating it) and then later in the routing section. Then there's the minor matter of using "rails generate" and "rails server" instead of "script/server" and "script/generate".
- fdschoeneman 16y agoI'd say not very much. I've been through the tutorial in both 2.3.5 and 3.0.0.beta and think the improvements in the latter justify developing in it. Probably a much more useful question to ask yourself is whether or not the plugins you'll need for your application have been tested, and work in Rails 3.
- mhartl 16y agoMost of your Rails 2.3 knowledge will still be good, but I would suggest developing your new app using Rails 3 if possible. I'll be working on the Rails 3 version of the tutorial over the next few weeks; keep your eyes peeled for an announcement when it's ready.