Ruby on Rails 4.0 Release Notes

Highlights in Rails 4.0:

These release notes cover only the major changes. To know about various bug fixes and changes, please refer to the change logs or check out the list of commits in the main Rails repository on GitHub.


Upgrading to Rails 4.0

If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 3.2 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 4.0. A list of things to watch out for when upgrading is available in the Upgrading to Rails guide.

Creating a Rails 4.0 application

You should have the 'rails' RubyGem installed
$ rails new myapp
$ cd myapp

Vendoring Gems

Rails now uses a Gemfile in the application root to determine the gems you require for your application to start. This Gemfile is processed by the Bundler gem, which then installs all your dependencies. It can even install all the dependencies locally to your application so that it doesn't depend on the system gems.

More information: Bundler homepage

Living on the Edge

Bundler and Gemfile makes freezing your Rails application easy as pie with the new dedicated bundle command. If you want to bundle straight from the Git repository, you can pass the --edge flag:

$ rails new myapp --edge

If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the --dev flag:

$ ruby /path/to/rails/railties/bin/rails new myapp --dev

Major Features

TODO. Give a list and then talk about each of them briefly. We can point to relevant code commits or documentation from these sections.

}[]

Extraction of features to gems

In Rails 4.0, several features have been extracted into gems. You can simply add the extracted gems to your Gemfile to bring the functionality back.

Documentation

Railties

Please refer to the Changelog for detailed changes.

Notable changes

Deprecations

Action Mailer

Please refer to the Changelog for detailed changes.

Notable changes

Deprecations

Active Model

Please refer to the Changelog for detailed changes.

Notable changes

Deprecations

Active Support

Please refer to the Changelog for detailed changes.

Notable changes

# ActiveSupport 3.x "asdf".to_date # => NoMethodError: undefined methoddiv' for nil:NilClass “333”.to_date # => NoMethodError: undefined method `div' for nil:NilClass

# ActiveSupport 4 “asdf”.to_date # => ArgumentError: invalid date “333”.to_date # => Fri, 29 Nov 2013 “`

Deprecations

Action Pack

Please refer to the Changelog for detailed changes.

Notable changes

Deprecations

Active Record

Please refer to the Changelog for detailed changes.

Notable changes

Deprecations

Credits

See the full list of contributors to Rails for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.