Rails 3.1: Release candidate

Posted by David May 22, 2011 @ 02:40 AM

As I promised at RailsConf, we’re finally good to go on the Rails 3.1: Release Candidate. This is a fantastically exciting release. We have three new star features and an even greater number of just awesome improvements. First the stars:

The Asset Pipeline
The star feature of 3.1 is the asset pipeline powered by Sprockets 2.0. It makes CSS and JavaScript first-class code citizens and enables proper organization, including use in plugins and engines. See my RailsConf keynote for a full tour. This comes with SCSS as the default for stylesheets and CoffeeScript as the default for JavaScript. Much documentation is on the way for this.

HTTP Streaming
This lets the browser download your stylesheet and javascripts while the server is still generating the response. The result is noticeable faster pages. It’s opt-in and does require support from the web server as well, but the popular combo of nginx and unicorn is ready to take advantage of it. There’s a great Railscast on HTTP streaming and the API documentation is strong too.

jQuery is now the default
We’ve made jQuery the default JavaScript framework that ships with Rails, but it’s silly easy to switch back to Prototype if you fancy. It’s all bundled up in the jquery-rails and prototype-rails gems. Just depend on the one you’d like in the Gemfile and it’ll Just Work.

Other good stuff:

  • Reversible migrations: DRY migrations that know how to revert themselves. Cleaner, nicer migrations.
  • Mountable engines: Engines can now have their own routing and helper scope. They can also take advantage of the asset pipeline (more documentation on this soon). Read the story behind mountable engines (even if the asset stuff is now out of date).
  • Identity Map: It’s not enabled by default because of some important caveats that are still to be ironed out, but if you can deal with those, it’s a great way to cut down on the number of queries your app will trigger. Faster is better!
  • Prepared statements: Active Record now uses cached prepared statements, which is a big boost for PostgreSQL in all cases and a boost for MySQL on complex statements.
  • Rack::Cache on by default: This makes it possible to use HTTP caching with conditional get as a replacement for page caching (which we’ll soon factor into a plugin and remove from core).
  • Turn test-output on Ruby 1.9: Much nicer test output courtesy of the Turn gem. It’s on with new applications by default on Ruby 1.9.
  • Force SSL: It’s now easier than ever to keep your app safe with force_ssl. Either per-app or per-controller.
  • Role-based mass-assignment protection: attr_protected now accepts roles, so it’s easier do deal with admin/non-admin splits and more.
  • has_secure_password: Dead-simple BCrypt-based passwords. Now there’s no excuse not to roll your own authentication scheme.
  • Custom serializers: Serialize objects with JSON or whatever else you’d like.

You can also check out the an even longer changelog and get a video overview from Railscast.

If you’re starting a new application, it’s strongly recommended that you do so using Ruby 1.9.2. Rails will continue to support 1.8.x until Rails 4.0, but it’s considered the legacy option. Ruby 1.9.x is where the action is. Get on board and enjoy the massive speed boost.

You can install the Rails 3.1: Release Candidate with gem install rails --pre. Enjoy and report any release candidate issues on Github. We expect to release the final version in a couple of weeks if all goes well.

Posted in Releases | 72 comments

Comments

  1. Brian Cardarella on 22 May 02:44:

    Delivered as promised. Nice!

  2. TonyC on 22 May 02:47:

    Hooray! Thanks for the work everybody!

  3. Hiroshi Hiromoto on 22 May 02:52:

    Great news!! Thanks for the hard work!!

  4. AndyL on 22 May 03:01:

    Loving CoffeeScript and SCSS.

  5. Ernie Miller on 22 May 03:06:

    Awesome work, guys!

  6. Gustavo Raúl Aragón on 22 May 03:09:

    Yeahh!!!! =)

  7. Eric Berry on 22 May 04:05:

    Excellent. Great job everyone!

  8. Pedro MEdeiros on 22 May 04:07:

    rapture with rc1!!!!

    great way to end the world

  9. Michal Kuklis on 22 May 04:09:

    Congrats guys! gem ‘rails’, ‘3.1.0.rc1’ :)

  10. kuroir on 22 May 04:41:

    For those who use Textmate and want to develop using .SCSS check out my Textmate Bundle, which is the most advanced and useful bundle out there for SCSS Developers :)

    https://github.com/kuroir/SCSS.tmbundle

  11. Levi Figueira on 22 May 05:02:

    Major props to the Core Team! This is almost worth a four-point-oh release!! :)

  12. Berislav Babic on 22 May 05:33:

    Rails rapture edition, sweet. Congratulations guys for making the life simple and awesome :)

  13. FrontCube on 22 May 06:13:

    Awesome! I think the this is the most sweet edition of Rails. CoffeScript , Saas and jQuery FTW!!!

    Thank you guys for the hard work. :)

  14. Trung Lê on 22 May 06:14:

    thanks guys

  15. Silverbizness on 22 May 06:16:

    Such a nice release! Good job!

  16. Messiah! on 22 May 06:55:

    Hell Yeah!

  17. Umit Kayacik on 22 May 08:43:

    Just started, $ rvm use 1.9.2 $ gem install rails—pre

  18. kewin wang on 22 May 10:45:

    GOOD

  19. CDainMiller on 22 May 11:58:

    Stoked! Cant wait to get my hands dirty. Keep killin it David

  20. Ken Collins on 22 May 13:04:

    The speed improvements gained by the prepared statement support under the SQL Server Adapter are huge! SQL Server already had a mechanism for taking advantage of cached query plans and ActiveRecord’s hooks to make this happen was a joy to implement. Thanks to everyone on core and especially Aaron for working on this feature!

  21. anand on 22 May 13:57:

    Nice release!

    BTW, anyone facing issues with jRuby ?

  22. websymphony on 22 May 13:58:

    Did anyone try to upgrade from 3.0.7 to 3.1? Issues, any Gotchas?

  23. Cody Russell on 22 May 13:59:

    Has anyone else been getting an error when installing activesupport-3.1.0.rc1?

    Installing RDoc documentation for activesupport-3.1.0.rc1… ERROR: While generating documentation for activesupport-3.1.0.rc1 ... MESSAGE: incompatible character encodings: UTF-8 and ASCII-8BIT ... RDOC args:—op /home/cody/.rvm/gems/ruby-1.9.2-p180/doc/activesupport-3.1.0.rc1/rdoc lib—title activesupport-3.1.0.rc1 Documentation—quiet

  24. Belinda on 22 May 14:27:

    I am impressed!!!!!!

  25. Pedro Assumpção on 22 May 14:37:

    Nice job, again!

  26. Jason Toy on 22 May 15:39:

    Is the plan for Identity map to be turned on by default when 3.1 stable is released?

  27. Marco Heerebout on 22 May 17:44:

    Great to have this version available. Impressive features and choices!

  28. Steve Schwartz on 22 May 18:19:

    One thing that is probably worth mentioning, concerning switching between prototype-rails and jquery-rails, is that the prototype-rails gem actually includes both the UJS stuff and the RJS stuff, while the jquery-rails gem includes only the UJS stuff. If you need the RJS functionality using jquery-rails, you’ll also need to add jrails.

    @Jason Toy, yes, identity map is turned on by default in Rails 3.1, and it’s awesome :-)

  29. Steve Schwartz on 22 May 18:23:

    @Jason Toy, oops, didn’t realize this recently changed since the pre-release 3.1 rails app I was working on. Identity map is off by default :-(

  30. Tom Myer on 22 May 18:55:

    Very nice, can´t wait to try out the new features. Congrats and a BIG thanks to everyone working on this fantastic release!

  31. Tex on 22 May 20:07:

    @Cody Russell, I’ve the same problem, cannot install activesupport rdoc due to incompatible character encodings: UTF-8 and ASCII-8BIT, the process has been stopped…

    BTW congratulations for the release candidate, released as promised at railsconf !!!

  32. J Melgoza on 22 May 20:10:

    Sweet!

  33. cbmeeks on 22 May 20:38:

    Thanks for the Rapture edition of RoR3.1!!!

    @Cody , @Tex

    I get the same error. However, running gem install rails—pre a second (or third) time works for me.

  34. hamish@gizbo.net on 22 May 22:10:

    Excited about the addition of Coffeescript.

  35. droff on 23 May 01:46:

    Good job!

  36. ariel on 23 May 02:36:

    Wonderful!

  37. iyanski on 23 May 05:16:

    Good Job!

  38. iyanski on 23 May 05:16:

    Good Job!

  39. ollie on 23 May 07:08:

    Bloody thanks! Nice work, can’t wait to get everything upgraded. :)

  40. almazom on 23 May 07:36:

    thanks for scss & coffescript)

  41. Nicolas Blanco on 23 May 08:52:

    “1.9.x is where the action is. Get on board and enjoy the massive speed boost.” > massive speed boost, massive speed boost… when it’s booted because Rails takes several more seconds to boot than on 1.8. it seems to be a ruby bug thougth…

  42. Cyril on 23 May 08:53:

    Amazing release! You’re awesome! Thanks!

  43. seb on 23 May 13:46:

    Happy with this release. Good job guys.

  44. charly on 23 May 15:13:

    And hurray for the identity map and for the mountable engines, and the role based mass assignement and god there’s too much goodness in there. thanks !

  45. Greg Molnar on 23 May 17:17:

    Thank you guys. A great upgrade again :)

  46. Eric on 23 May 17:41:

    @Cody, @Tex,

    I hit the same error, but simply executing the command again worked. Thanks CBMeeks!

  47. codercaste.com on 24 May 03:14:

    Great release indeed guys ! Hope we are close to the stable one :) This one looks pretty nice !

  48. Nilanga Saluwadana on 24 May 10:11:

    Thanks you guys for this release, This is great coz jQuery is default.

  49. Eric Heidelmark on 24 May 14:23:

    I’m getting this on every ActiveRecord call. It just seems broken:

    ruby-1.9.2-p180 :003 > BlogPost.first (0.7ms) SHOW TABLES (1.7ms) describe `blog_posts` (0.3ms) SHOW TABLES ArgumentError: wrong number of arguments (3 for 2)

    Back to 3.0.7, I suppose.

  50. Necrower on 24 May 16:11:

    Hope sprokets and rake version incompability has been fixed. Rails 3.1 is awesome!

  51. stephen on 25 May 11:14:

    anyone else having trouble installing mime-types gem for rails3.1?

    I’m on ubuntu 10.10 and I’m getting the following error message:

    Fetching: mime-types-1.16.gem ( 97%)ERROR: While executing gem … (Gem::RemoteFetcher::FetchError) too many connection resets (http://production.cf.rubygems.org/gems/mime-types-1.16.gem)

  52. underley on 26 May 07:27:

    I hope, there is way to disable usage of prepared statements? It’s not true, that it’s “big boost for PostgreSQL in all cases”: http://www.depesz.com/index.php/2008/05/10/prepared-statements-gotcha/

  53. Sheldon Hearn on 26 May 09:26:

    @Cody Russell: Yes, you’re not the only one getting a docbuild error. :-)

  54. Matthew Carriere on 26 May 22:17:

    @Eric Heidelmark: I am having the same issue… any resolution?

  55. Tomek on 27 May 17:23:

    @Eric Heidelmark – please update the mysql2 gem to the lates version – you have probably locked it to an older version, which isn’t compatible with rails 3.1. It worked for me.

  56. nona on 27 May 23:23:

    Anyone else having problems with rails 3.1 on sub-URIs? seems like I keep getting links to ”/assets/” instead of ”/sub-uri/assets/”.(using passenger 3.0.7)

    I’m trying to debug what’s going in actionpack, but I haven’t figured it out yet.

  57. nona on 30 May 20:13:

    Replying to myself, in case anyone else is wondering:

    It’s fixed on master, see https://github.com/rails/rails/commit/db5adf2d42d16859cde8f40e7b0b7fb41167cff4

    Thanks Geoff Jacobsen ;-)

  58. Chris Vincent on 30 May 23:01:

    I’m getting the following when running gem install rails—pre on a fresh RVM gemset:

    ERROR: While executing gem … (NameError) uninitialized constant Syck::Syck

  59. Yukio Ueno on 30 May 23:36:

    Great job! Thank you for the hard work.

  60. Felix on 31 May 00:11:

    @Crhis Vincent: I was getting the same error, then after a few times trying to install rails 3.1 I now get:

    ERROR: While executing gem … (NameError) uninitialized constant Psych::Syck

    I’m also using a fresh gemset with rvm and ruby 1.9.2-head

  61. Greg on 31 May 01:32:

    @Chris Vencent, @Felix

    Saw this too. I think it’s related to all the 3.0.8rc4 stuff going on right now.

    I got around it by using

    gem ‘rails’, ‘>=3.1.0.rc1’

    in my Gemfile and doing a ‘bundle update’

  62. hipertracker on 31 May 09:35:

    Something is broken. Just tested under WinXP.

    ruby -v ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

    gem -v 1.8.4

    gem install rails—pre ERROR: While executing gem … (NameError) uninitialized constant Psych::Syck

    jruby -v jruby 1.6.2 (ruby-1.8.7-p330) (2011-05-23 e2ea975) (Java HotSpot™ Client VM 1.6.0_25) [Windows XP-x86-java]

    jruby -S gem install rails—pre ERROR: While executing gem … (ArgumentError) undefined class/module YAML::Syck::DefaultKey

  63. Arne De Herdt on 31 May 14:45:

    While I rejoice for this release, I’m beeing more sceptical every day with my Ruby on Rails projects due the increasing lack of Windows Support….

    believe it or not, but some people do actually develop & deploy on Windows Servers…

  64. Chyld Medford on 01 Jun 04:03:

    Can’t wait to kick the tires!

  65. rchamp on 01 Jun 13:02:

    I’ve met the same

    ERROR: While executing gem … (NameError) uninitialized constant Syck::Syck

    issue with: gem install rails—pre

    Get around with: gem install rails -v ”>=3.1.0rc”

  66. shime on 03 Jun 09:16:

    thanks for the notice rchamp, worked for me after Syck error :)

  67. Nexis on 03 Jun 18:16:

    YESSSS!! They finally make Sass and CoffeeScript default. This is ingenious!

  68. CWT on 08 Jun 15:16:

    One of the most exciting release in Rails history, in my humble opinion! Congratulations.

    As an effort to get my hands dirty, I am trying out the 3.1 RC and apparently when trying to do a remote call (ajax) calling the controller such as this:

    def remote_call render :update do |page| page << “alert(‘can you read me?’)” end end

    It doesn’t work and throws a “Missing Template” error expecting “controller_name/update, application/update”

    Can someone shed light to the render :update usage with jQuery as the default?

    Many thanks in advance, Chad

  69. uchenna on 10 Jun 22:07:

    image tag helper is not working

  70. Wealth Trigger Review on 13 Jun 02:24:

    It is no use doing what you like ; you have got to like what you do .http://www.wealthtriggerreview.org/

  71. Saurabh Purnaye on 13 Jun 15:24:

    Cool

  72. martynas on 14 Jun 20:13:

    CWT, apparently with rails_ujs no javascript rendering in controllers, so You have to use for example *.js.erb and render that view/javascript from controller or write ajax:complete ajax:success callbacks for a remote link in view file, which renders remote link/form.

    render :text => “alert (‘uuuu’);” could do the trick, but it is not recommended way :)