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::Streamingfor more information. Middleware have been refactored to support this feature.RJS has been extracted to a gem.
ActiveModel
attr_accessibleand friends now accepts :as as option to specify a roleAdded
ActiveModel::SecurePasswordto encapsulate dead-simple password usage with BCrypt encryption and salting.
ActiveRecord
Prepared statement caches have been integrated.
ActiveRecord::Base#createand 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_scopecan take any object that responds tocall.PostgreSQL adapter only supports PostgreSQL version 8.2 and higher.
Migrations use instance methods rather than class methods. Rather than defining a
self.upmethod, you should define an instance methodup.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 forActiveRecord::MigrationandActiveRecord::Migration::CommandRecorder.When a model is generated,
add_indexis added by default forbelongs_toorreferencescolumns.
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 = :xmlin 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_agoandprev_weekto Date/DateTime/Time.JSON decoding now uses the
multi_jsongem 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_headeris present.Add alias
rfor rails runner.jQuery is the new default JavaScript library.
Added
config.force_sslconfiguration 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

Woo Hoo!
Good work!
Awesome! Thanks for you commitment and hard work!
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!
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. :)
Ai sim em! show!
Excellent work guys – looking forward to migrating our app to Rails 3.1. Cheers!
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.
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…
AWESOME!!!
AWESOME!!!
Winning!
Better than the best. Thanks for core team and the community for the painstaking hard work during this cycle.
<3>
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…
Fantastic!
Wow great!!! Have been waiting eagerly to try it out. Great job.
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.
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
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.
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
Good News! Thanks for all your works. Thanks again
Thanks to all of you
in ubuntu 11.04 add below two lines into Gemfile
gem ‘execjs’ gem ‘therubyracer’
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.
Rolled back to rc8 without any other changes and the above “image cannot be displayed” error goes away and images display correctly.
Thank you to all who contributed to this release.
Congratulations David and to the entire Rails team!
This community has done a wonderful job!
All of us love Rails.
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!
Congratulations!
Good enough just isn’t good enough!, I love this amazing community, you keep impressing me!.
Thank you all!
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.
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.
I so desperately waited for that Release!
Can’t wait to upgrade my projects!
Thanks a LOT.
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.
Good job guys!
Sweeeet!
It just keeps getting better and better! Love it! Thanks to everyone for all the hard work. :)
Excellent, congratulations with this new release!
Nice!
Just 3 months after Rails Conf.. this is just awesome.
Love it!!
“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.
Great job! Thanks!
Thank you! I love rails!
Thank you! I love rails!
Great job guys, awesome framework! I wonder what’s in your mind right now about next releases…
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.
Thank you very much! :D
Congratulations, well done!
Awesome accomplishment! jQuery is the default JavaScript library!
Getting better…
Thank´s core team! Amazing job!
Really nice, thank you!
Awesome, keep the good work!
I’m also having the JRuby Brcypt installation issue reported above by Anand.
It is blindingly wonderful! I hope to never look back.
It is blindingly wonderful! I hope to never look back.
Nice, many thanks, great job!
Cool!
Super Kool. Thanks!
Tenderlove for president!
Updated my project from to 3.1 and fairly painless! Kudos and THANKS THANKS THANKS!
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.
Thanks again!
Very good news!thanks
Great work!
Congratulations!
You should make sure to tag this blog post with “Releases” btw
Congratulations!!! You are so awesome!!!
congratulations!!! love rails~!!
@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!
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/
@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.
This is GREAT !!
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.
Congratulations to core team members and community.
Thank You..
Thank you. I Love Ruby On Rails.
Great job guys
Now we will see many fast loading web sites. Asset compilation and HTTP streaming is cool.. Congrats!
@anand. Have same problem on jruby 1.6.3 on OS X. When installing bcrypt it tries to compile? No clue
@gdj the error will be fixed in 3.1.1
@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.
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).
Good news !!!!. Congratulations to all the people who worked hard for the community benefit.
@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.
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.
@Mike
I you’re that unhappy with 3.1, why not stick with 3.0.9 the?
@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.
ohhh excellent job! Thanks core team…..
Ramaze is still better…
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.
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.
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.
@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.I a soooo glad to work with rails 3.1.0. It’s simply awesome
feel one step closer to a true website development product for me