What to Expect in Rails 4

Posted by mikhailov on Stack Overflow See other posts from Stack Overflow or by mikhailov
Published on 2012-09-12T03:17:27Z Indexed on 2012/09/12 3:38 UTC
Read the original article Hit count: 219

Filed under:

Rails 4 is nearly there, we should be ready before it released. Most developers are trying hard to keep their application on the edge.

Must see resources:

1) @sikachu talk: What to Expect in Rails 4.0 - YouTube

2) Rails Guides release notes: http://edgeguides.rubyonrails.org/4_0_release_notes.html

There is a mix of all major changes down here:

ActionMailer changes excerpt:

  • Asynchronously send messages via the Rails
  • Raise an ActionView::MissingTemplate exception when no implicit template could be found

ActionPack changes excerpt

  • Added controller-level etag additions that will be part of the action etag computation
  • Add automatic template digests to all CacheHelper#cache calls (originally spiked in the cache_digests plugin)
  • Add Routing Concerns to declare common routes that can be reused inside others resources and routes
  • Added ActionController::Live. Mix it in to your controller and you can stream data to the client live
  • truncate now always returns an escaped HTML-safe string. The option :escape can be used as false to not escape the result
  • Added ActionDispatch::SSL middleware that when included force all the requests to be under HTTPS protocol

ActiveModel changes excerpt

  • AM::Validation#validates ability to pass custom exception to :strict option
  • Changed `AM::Serializers::JSON.include_root_in_json' default value to false. Now, AM Serializers and AR objects have the same default behaviour
  • Added ActiveModel::Model, a mixin to make Ruby objects work with AP out of box
  • Trim down Active Model API by removing valid? and errors.full_messages

ActiveRecord changes excerpt

  • Use native mysqldump command instead of structure_dump method when dumping the database structure to a sql file.
  • Attribute predicate methods, such as article.title?, will now raise ActiveModel::MissingAttributeError if the attribute being queried for truthiness was not read from the database, instead of just returning false
  • ActiveRecord::SessionStore has been extracted from Active Record as activerecord-session_store gem. Please read the README.md file on the gem for the usage
  • Fix reset_counters when there are multiple belongs_to association with the same foreign key and one of them have a counter cache
  • Raise ArgumentError if list of attributes to change is empty in update_all
  • Add Relation#load. This method explicitly loads the records and then returns self
  • Deprecated most of the 'dynamic finder' methods. All dynamic methods except for find_by_... and find_by_...! are deprecated
  • Added ability to ActiveRecord::Relation#from to accept other ActiveRecord::Relation objects
  • Remove IdentityMap

ActiveSupport changes excerpt

  • ERB::Util.html_escape now escapes single quotes
  • ActiveSupport::Callbacks: deprecate monkey patch of object callbacks
  • Replace deprecated memcache-client gem with dalli in ActiveSupport::Cache::MemCacheStore
  • Object#try will now return nil instead of raise a NoMethodError if the receiving object does not implement the method, but you can still get the old behavior by using the new Object#try!
  • Object#try can't call private methods
  • Add ActiveSupport::Deprecations.behavior = :silence to completely ignore Rails runtime deprecations

What are the most important changes for you?

© Stack Overflow or respective owner

Related posts about ruby-on-rails-4