Rails 3.1.0 has been released!

Posted by aaronp August 31, 2011 @ 09:20 PM

Hi everybody!

It's been 3 Months since RailsConf, so I think it's time we released Rails 3.1.0. So, here it is! I've released Rails 3.1.0!

CHANGES

For a much more attractive and easy to read list of changes, please check out the awesome Rails 3.1.0 Release Notes on the Rails Guides site. For a less attractive list of changes, please continue to read!

Here are some highlights of the major changes in Rails 3.1.0:

ActionPack

  • ActionPack has been updated to include the new asset pipeline. Please see the rails guides on the asset pipeline.

  • Streaming response support has been added. This feature allows you to stream templates to the user before processing has actually finished. See the Rails Guides, or documentation in ActionController::Metal::Streaming for more information. Middleware have been refactored to support this feature.

  • RJS has been extracted to a gem.

ActiveModel

  • attr_accessible and friends now accepts :as as option to specify a role

  • Added ActiveModel::SecurePassword to encapsulate dead-simple password usage with BCrypt encryption and salting.

ActiveRecord

  • Prepared statement caches have been integrated. ActiveRecord::Base#create and simple finders will use a prepared statement and cache for more performant inserts and selects.

  • Associations have been refactored for greater simplicity and maintainability.

  • default_scope can take any object that responds to call.

  • PostgreSQL adapter only supports PostgreSQL version 8.2 and higher.

  • Migrations use instance methods rather than class methods. Rather than defining a self.up method, you should define an instance method up.

  • Migrations are reversible. When a new migration is generated, the migration will contain one method called change. Database changes made in this method will automatically know how to reverse themselves. For more information, see the documentation for ActiveRecord::Migration and ActiveRecord::Migration::CommandRecorder.

  • When a model is generated, add_index is added by default for belongs_to or references columns.

ActiveResource

  • The default format has been changed to JSON for all requests. If you want to continue to use XML you will need to set self.format = :xml in the class.

ActiveSupport

  • ActiveSupport::BufferedLogger set log encoding to BINARY, but still use text mode to output portable newlines.

  • Add Object#in? to test if an object is included in another object.

  • ActiveSupport::Dependencies::ClassCache class has been introduced for holding references to reloadable classes.

  • Added weeks_ago and prev_week to Date/DateTime/Time.

  • JSON decoding now uses the multi_json gem which also vendors a json engine called OkJson. The yaml backend has been removed in favor of OkJson as a default engine for 1.8.x, while the built in 1.9.x json implementation will be used by default.

Railties

  • The default database schema file is written as UTF-8.

  • Rack::Sendfile middleware is used only if x_sendfile_header is present.

  • Add alias r for rails runner.

  • jQuery is the new default JavaScript library.

  • Added config.force_ssl configuration which loads Rack::SSL middleware and force all requests to be under HTTPS protocol

For more info

For a more detailed list of changes, please see each of the CHANGELOG files checked in to the Rails repository on github.

For an even more detailed list of changes, please see the commit list between Rails 3.0.10 and 3.1.0.

The End

I am personally very proud of this release. I want to say thank you to the people testing our release candidates, the people submitting patches and sending in bug reports. I think that Rails 3.1.0 is the best release of Rails to date, and we could not have done it without you.

Please continue to create amazing things with this framework!

SHA-1

  • b68f74ced662145a4139409edf3c51db1159ead8 actionmailer-3.1.0.gem
  • 136474f270677ae75ad0f9599d26e89cf1d4bc7b actionpack-3.1.0.gem
  • e6b68453c08bb0da52ed1d422ba2f87a5e3aa794 activemodel-3.1.0.gem
  • dfbae15c0d395304812c22fbf18aa9daadbe20b4 activerecord-3.1.0.gem
  • 3f1f547e500d1ffc1f7c3ee4ab9eb1526157a870 activeresource-3.1.0.gem
  • f21627c2f429abfa8685d2147fadab6704c13869 activesupport-3.1.0.gem
  • 21c6592189fb358a066846754a8f7ce7a238fca6 rails-3.1.0.gem
  • 79cfa1eca232de9a45453829287e4438089b7955 railties-3.1.0.gem

<3 <3 <3

96 comments

Comments

  1. Eric Koslow on 31 Aug 21:36:

    Woo Hoo!

  2. Joe Bader on 31 Aug 21:45:

    Good work!

  3. Craig Knox on 31 Aug 21:54:

    Awesome! Thanks for you commitment and hard work!

  4. TVD on 31 Aug 21:54:

    Wow! Rails 3.1 has so much goodness wrapped up in it. Talk about pouring on a well deserved heaping of AWESOMESAUCE!

    -jQuery is the new default JavaScript library.

    -BCrypt encryption.

    -The default database schema file is written as UTF-8.

    Thanks guys!

  5. Jase on 31 Aug 21:58:

    Yay at last… it’s taken enough betas/rc’s! Thanks to everyone who slaved their time, guts, sweat and other bodily sacrifices to make this happen. :)

  6. Dennis on 31 Aug 22:00:

    Ai sim em! show!

  7. Andrew Retmanski on 31 Aug 22:10:

    Excellent work guys – looking forward to migrating our app to Rails 3.1. Cheers!

  8. Brian Getting on 31 Aug 22:17:

    Update from 3.1.0rc8 to 3.1.0 in production breaks the stylesheet_link_tag method for us. Now outputs:

    <link href="/assets/application.css" rel="stylesheet" type="text/css" media="screen" />

    instead of adding the hash value to the end of the file.

  9. miguelsan on 31 Aug 23:05:

    A pity that Identity Map (surely a huge improvement) remains turned off by default. There is only one opened bug relating to it, and a patch has been already submitted 10 days ago…

  10. Thiago Taranto on 31 Aug 23:30:

    AWESOME!!!

  11. Thiago Taranto on 31 Aug 23:36:

    AWESOME!!!

  12. Jesse Knutsen on 31 Aug 23:40:

    Winning!

  13. Jones Lee on 31 Aug 23:43:

    Better than the best. Thanks for core team and the community for the painstaking hard work during this cycle.

  14. Matt on 31 Aug 23:51:

    <3>

  15. Chad on 01 Sep 00:09:

    And they said the last mile is always the hardest!

    Congratulations all—I’ve been looking forward to this for weeks and months!

    Let the fun begin…

  16. Dmitry Plashchynski on 01 Sep 00:10:

    Fantastic!

  17. Prabhakar Karve on 01 Sep 01:07:

    Wow great!!! Have been waiting eagerly to try it out. Great job.

  18. Mike G250 on 01 Sep 01:53:

    Thank you. Thank you for all the hard work. Thank you for giving me an alternative to PHP and .Net Thank you for teaching MS that webforms sucks. Thank you to the entire Ruby/Rails community for making so many wonderful gems. And as a business person, thank you for making a web development platform that doesn’t require Ivory Tower thinking and the huge expense that goes along with it.

  19. UnderpantsGnome on 01 Sep 02:07:

    If you were running the RCs and you aren’t getting digested asset paths in production, add this to your production.rb

    config.assets.digest = true

  20. anand on 01 Sep 02:10:

    Is anybody else facing issues with bcrypt-ruby and jRuby 1.6,4 while installing 3.1? Worked till rc6!

    Installing bcrypt-ruby (3.0.0) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    c:/jruby-1.6.4/bin/jruby.exe extconf.rb

    make ‘make’ is not recognized as an internal or external command, operable program or batch file.

    Gem files will remain installed in c:/jruby-1.6.4/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.0-java for inspection. Results logged to c:/jruby-1.6.4/lib/ruby/gems/1.8/gems/bcrypt-ruby-3.0.0-java/ext/mri/gem_make.out

  21. Kewin Wang on 01 Sep 02:19:

    Good News! Thanks for all your works. Thanks again

  22. Thani on 01 Sep 02:42:

    Thanks to all of you

  23. ubuntu 11.04 on 01 Sep 02:48:

    in ubuntu 11.04 add below two lines into Gemfile

    gem ‘execjs’ gem ‘therubyracer’

  24. fmorton on 01 Sep 02:57:

    Was fine with rc4, but 3.1.0 (with nginx 1.0.6 and passenger 3.0.8) returns “cannot be displayed because it contains errors” on some images in production only. Same problem with multiple browsers.

    I do have this set in production.rb: config.action_dispatch.x_sendfile_header = “X-Accel-Redirect”.

    Glad to hear any suggestions to try.

  25. fmorton on 01 Sep 04:03:

    Rolled back to rc8 without any other changes and the above “image cannot be displayed” error goes away and images display correctly.

  26. Scott Wolff on 01 Sep 04:04:

    Thank you to all who contributed to this release.

  27. Andrew Davis on 01 Sep 04:12:

    Congratulations David and to the entire Rails team!

    This community has done a wonderful job!

  28. Richy on 01 Sep 04:13:

    All of us love Rails.

  29. Daniel Fischer on 01 Sep 05:39:

    I love you tender love and everyone that has contributed to this release. It’s a leap forward; especially for front-end which I live in so dearly. Haha.

    Thanks again!

  30. Falk Köppe on 01 Sep 06:33:

    Congratulations!

  31. Javier Blanco on 01 Sep 07:36:

    Good enough just isn’t good enough!, I love this amazing community, you keep impressing me!.

    Thank you all!

  32. Ladislav Smola on 01 Sep 07:42:

    In the production, rails 3.1.0 Hash value to the end of the file is not added even when we use image_tag and other *._tag methods.

  33. Donald Piret on 01 Sep 08:14:

    Rails 3.1 (new version of AREL) seems to override custom select when I use includes, has anybody else run into this? Didn’t use to do this before.

  34. Fabian Müller on 01 Sep 10:27:

    I so desperately waited for that Release!

    Can’t wait to upgrade my projects!

    Thanks a LOT.

  35. Oskar Boethius Lissheim on 01 Sep 10:35:

    So much goodness in this release, can’t wait to migrate our ForMembers project over! HTTP Streaming will be a nice client-side speed boost to our mobile HTML page rendering.

  36. Lionel Félicité on 01 Sep 11:52:

    Good job guys!

  37. Brian on 01 Sep 12:02:

    Sweeeet!

  38. Jo Potts on 01 Sep 12:05:

    It just keeps getting better and better! Love it! Thanks to everyone for all the hard work. :)

  39. Wilco on 01 Sep 13:35:

    Excellent, congratulations with this new release!

  40. Mariusz on 01 Sep 13:47:

    Nice!

  41. Americo Savinon on 01 Sep 13:50:

    Just 3 months after Rails Conf.. this is just awesome.

  42. D'andre on 01 Sep 14:21:

    Love it!!

  43. Nathan Youngman on 01 Sep 15:07:

    “The yaml backend has been removed in favor of OkJson”

    Should this be Yajl?

    Awesome release. The smaller changes, like adding indexes are nice. Details matter.

  44. Aleaxander on 01 Sep 15:30:

    Great job! Thanks!

  45. Tomaž on 01 Sep 16:02:

    Thank you! I love rails!

  46. Tomaž on 01 Sep 16:02:

    Thank you! I love rails!

  47. Ruben Carballo Macklis on 01 Sep 16:09:

    Great job guys, awesome framework! I wonder what’s in your mind right now about next releases…

  48. webmat on 01 Sep 16:13:

    Thanks guys for this great release!

    @anand: About the problem “make ‘make’ is not recognized …”: You’re having that problem because you just upgraded to Lion. You need to get the most recent version of XCode. The one you have doesn’t work with Lion.

  49. @jonasanx on 01 Sep 16:30:

    Thank you very much! :D

  50. Ernst on 01 Sep 16:39:

    Congratulations, well done!

  51. Bent Cardan on 01 Sep 17:55:

    Awesome accomplishment! jQuery is the default JavaScript library!

  52. Suninny on 01 Sep 19:46:

    Getting better…

  53. Peterson Ferreira on 01 Sep 20:26:

    Thank´s core team! Amazing job!

  54. groe on 01 Sep 22:23:

    Really nice, thank you!

  55. OyoKooN on 01 Sep 22:25:

    Awesome, keep the good work!

  56. Wlater on 01 Sep 22:55:

    I’m also having the JRuby Brcypt installation issue reported above by Anand.

  57. AndyNu on 01 Sep 23:22:

    It is blindingly wonderful! I hope to never look back.

  58. AndyNu on 01 Sep 23:22:

    It is blindingly wonderful! I hope to never look back.

  59. Zoli on 02 Sep 02:40:

    Nice, many thanks, great job!

  60. Jungwook on 02 Sep 03:05:

    Cool!

  61. Ariel on 02 Sep 04:23:

    Super Kool. Thanks!

  62. ablemike on 02 Sep 04:29:

    Tenderlove for president!

  63. KevinTriplett on 02 Sep 05:06:

    Updated my project from to 3.1 and fairly painless! Kudos and THANKS THANKS THANKS!

  64. nkokkos@gmail.com on 02 Sep 06:46:

    Hi. Great work. I can confirm that on windows vista is at least 25% faster than the 3.0.x version! And I use Ruby 1.8.7 from the Rails Installer.

  65. ollie on 02 Sep 11:22:

    Thanks again!

  66. IBRAHIM ATAY on 02 Sep 11:45:

    Very good news!thanks

  67. Chyld Medford on 02 Sep 15:26:

    Great work!

  68. Grant Hutchins on 02 Sep 17:16:

    Congratulations!

    You should make sure to tag this blog post with “Releases” btw

  69. Wang Haiyi on 03 Sep 04:46:

    Congratulations!!! You are so awesome!!!

  70. Savin Max on 03 Sep 15:59:

    congratulations!!! love rails~!!

  71. Kevin Triplett on 03 Sep 23:54:

    @fmorton did you figure out the solution to your image error? I have the same problem, with .png images in my assets/images/icons folder.

    Otherwise, a terrific release, thanks!

  72. Chaz Beneke on 04 Sep 15:07:

    Some resources to get you up to speed on Rails 3.1. Includes screencasts, tutorials, etc. Covers topics like SCSS, IndentityMap, CoffeeScript, deploying with the asset pipeline, and more.

    http://jasonrudolph.com/blog/2011/06/06/helpful-resources-for-upgrading-to-rails-3-1/

  73. Kevin Triplett on 04 Sep 18:50:

    @fmorton (and others with the “cannot be displayed because it contains errors” images under production, regardless of browser): try clearing your browser cache. I know it sounds weird, but here are the steps I took: I followed the assets pipeline instructions complete with manifest files, that didn’t work. I precompiled. That didn’t work. I finally created a fresh Rails 3.1 app and tried to replicate the error by adding each gem and config setting, trying to break it but couldn’t. But when I went back to my original app and LO! there were the images! So I cleared my caches. All the images load on my dev machine running in production and now my production server. YMMV.

  74. Nate on 04 Sep 20:12:

    This is GREAT !!

  75. Kevin Triplett on 04 Sep 21:34:

    One more image “cannot be displayed because it contains errors” verification: just checked a browser at work where I’ve been using the production app. No images. Cleared the browser cache and images load. Not expected behavior but maybe someone can explain why I’m being stupid. Anyhow, that’s how I solved my particular problem.

  76. a-bpansheriya@gloscon.com on 05 Sep 03:53:

    Congratulations to core team members and community.

    Thank You..

  77. rahat on 05 Sep 11:02:

    Thank you. I Love Ruby On Rails.

  78. cong on 05 Sep 16:18:

    Great job guys

  79. http://www.railshouse.com on 06 Sep 02:13:

    Now we will see many fast loading web sites. Asset compilation and HTTP streaming is cool.. Congrats!

  80. gdj on 06 Sep 21:32:

    @anand. Have same problem on jruby 1.6.3 on OS X. When installing bcrypt it tries to compile? No clue

  81. guille on 06 Sep 23:54:

    @gdj the error will be fixed in 3.1.1

  82. fmorton on 07 Sep 01:06:

    @Kevin Triplett I resolved it by running on rc8 for now. I’ll do another pass and follow your suggestions more completely than I did before with 3.1.1. Thanks for the info.

  83. Mikael Henrikssson on 07 Sep 21:27:

    Hey guys,

    When we released to production none of the images are served properly. They are just blank or not there but when I navigate to them they are served as not modified.

    Any help appreciated! Tried clearing browser cache without luck. Running passenger 3.0.7, nginx (something).

  84. Lucas on 07 Sep 23:29:

    Good news !!!!. Congratulations to all the people who worked hard for the community benefit.

  85. Kevin Triplett on 08 Sep 14:38:

    @Mikael I was afraid it was not as simple as clearing the cache. I’m also experiencing a strange render issue where I have to use ’=’ instead of the normal ’-’ with methods that take blocks (like form_for). I’ll track it down this weekend and report back.

    In the meantime, comb through your code for anything that is old, or try generating a fresh new project and seeing what the differences are between your code and the fresh one’s config files. Also, follow the Rails guides on asset locations and make sure you follow them exactly. That’s also what I did (in addition to the browser cache which is what I had to do before I could see the images on the machine where I had tried to view them earlier).

    Strange issue, seems to be only a handful of people? Maybe we should all get together and get enough information to start an issue on github.com/rails/rails.

  86. Mike on 09 Sep 07:45:

    Thanks a lot, you added a lot of needless features that should be plugins and broke my web app that runs flawlessly with 3.0.9.

    The way things are going is that by 3.3, Rails will be more bloated and complex then insert your favorite Java framework whipping boy.

    Good work.

  87. Ricardo on 11 Sep 17:55:

    @Mike

    I you’re that unhappy with 3.1, why not stick with 3.0.9 the?

  88. Keil Miller on 13 Sep 12:14:

    @Mike “needless features that should be plugins”?!

    SASS – if you aren’t using it, you should be. But you dont have to. JQUERY – Well, previous rails used prototype by default, with an option for jquery so I don’t see your argument there. Asset pipeline – Umm… It makes paths easier. Combines CSS and JS into a single file. Migrations drop dropped – It just works. Less code = better.

    What’s the complaint?

    Rails 3.1 is an awesome upgrade. Thank you.

  89. ashok miryala on 14 Sep 10:49:

    ohhh excellent job! Thanks core team…..

  90. Ramaze on 14 Sep 18:47:

    Ramaze is still better…

  91. Mike on 15 Sep 21:22:

    The point is that a minor point release broke my app.

    I have to waste an entire day pulling out the needless cruft and tweaking things just so I can continue getting performance and security updates.

    I wouldn’t be as upset if he added this stuff for Rails 4, but it would still be a stupid decision. At most it should be commented out in Gemfile by default like aws, nokogiri, etc.

    I guarantee you that most people will be commenting it out and every new beginners rails books will recommend commenting it out.

    CoffeeScript is the worst idea ever. It is syntactic sugar that makes it harder to debug js.

    All you DHH sycophants are going to cry when coffeescript of sass outputs error-ridden code.

    It is also ironic that these two gems are added in but Haml is still not the default. Wanna know why Haml isn’t in by default, even though it is far closer to the alleged goals of Rails then erb is? Because DHH is a wannabe cargo-cult leader.

    He rips on the widespread use of Rspec over the crap Test::Unit and is actually upset about it because he can’t stand people not blindly following him.

    It has the bad points of ActiveRecord(you don’t need to understand databases) which is at least a true abstraction so does have real benefits.

    If you don’t understand javascript you should not be writing web apps, period.

    I wish Yahuda would fork Rails so DHH can be marginalized. He is bad for Ruby and Rails.

  92. Mike on 15 Sep 21:49:

    Anyone who thinks that DHH had anything to do with how good Rails 3.0.x is, is deluding themselves.

    Rails would be in the “where are they now” file without the Merb team saving 37 signals poor software engineering.

  93. sriram on 18 Sep 13:20:

    its good and easy to work on rails 3.1.0 with some extra functionalities compare to 3.0.8 also included some user interface advanced look while using rails 3.1.0.

  94. Kevin Triplett on 19 Sep 16:53:

    @Mikael (and anyone else with the strange images error): I was unable to find out what the problem was, sorry. As for the render issue where I now have to use ”=” instead of “” (or <= %> instead of < %>) for helpers like form_for, that appears to be an issue in ActionView and a friend of mine is looking into it.

  95. kvramana on 22 Sep 04:45:

    I a soooo glad to work with rails 3.1.0. It’s simply awesome

  96. milleniumsalman@gmail.com on 22 Sep 11:54:

    feel one step closer to a true website development product for me