DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.
Ruby on Rails 5.0 Release Notes
Highlights in Rails 5.0:
- Action Cable
RailsAPI- Active Record Attributes API
- Test Runner
- Exclusive use of
railsCLI over Rake - Sprockets 3
- Turbolinks 5
- Ruby 2.2.2+ required
These release notes cover only the major changes. To learn about various bug
fixes and changes, please refer to the changelogs or check out the list of
commits in the main Rails
repository on GitHub.
Upgrading to Rails 5.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 4.2 in case you
haven't and make sure your application still runs as expected before attempting
an update to Rails 5.0. A list of things to watch out for when upgrading is
available in the
Upgrading Ruby on Rails
guide.
Major Features
Action Cable
Action Cable is a new framework in Rails 5. It seamlessly integrates
WebSockets with the rest of your
Rails application.
Action Cable allows for real-time features to be written in Ruby in the
same style and form as the rest of your Rails application, while still being
performant and scalable. It's a full-stack offering that provides both a
client-side JavaScript framework and a server-side Ruby framework. You have
access to your full domain model written with Active Record or your ORM of
choice.
See the Action Cable Overview guide for more information.
API Applications
Rails can now be used to create slimmed down API only applications.
This is useful for creating and serving APIs similar to X or GitHub API,
that can be used to serve public-facing, as well as, for custom applications.
You can generate a new api Rails app using:
$ rails new my_api --api
This will do three main things:
- Configure your application to start with a more limited set of middleware than normal. Specifically, it will not include any middleware primarily useful for browser applications (like cookies support) by default.
- Make
ApplicationControllerinherit from::ActionController::APIinstead of::ActionController::Base. As with middleware, this will leave out any Action Controller modules that provide functionalities primarily used by browser applications. - Configure the generators to skip generating views, helpers, and assets when you generate a new resource.
The application provides a base for APIs, that can then be configured to pull in functionality as suitable for the application's needs.
See the Using Rails for API-only Applications guide for more information.
Active Record attributes API
Defines an attribute with a type on a model. It will override the type of existing attributes if needed.
This allows control over how values are converted to and from SQL when assigned to a model.
It also changes the behavior of values passed to ActiveRecord::Base.where, which let's use our domain objects across much of Active Record,
without having to rely on implementation details or monkey patching.
Some things that you can achieve with this:
- The type detected by Active Record can be overridden.
- A default can also be provided.
- Attributes do not need to be backed by a database column.
# db/schema.rb
create_table :store_listings, force: true do |t|
t.decimal :price_in_cents
t.string :my_string, default: "original default"
end
# app/models/store_listing.rb
class StoreListing < ActiveRecord::Base
end
store_listing = StoreListing.new(price_in_cents: '10.1')
# before
store_listing.price_in_cents # => BigDecimal.new(10.1)
StoreListing.new.my_string # => "original default"
class StoreListing < ActiveRecord::Base
attribute :price_in_cents, :integer # custom type
attribute :my_string, :string, default: "new default" # default value
attribute :my_default_proc, :datetime, default: -> { Time.now } # default value
attribute :field_without_db_column, :integer, array: true
end
# after
store_listing.price_in_cents # => 10
StoreListing.new.my_string # => "new default"
StoreListing.new.my_default_proc # => 2015-05-30 11:04:48 -0600
model = StoreListing.new(field_without_db_column: ["1", "2", "3"])
model.attributes # => {field_without_db_column: [1, 2, 3]}
Creating Custom Types:
You can define your own custom types, as long as they respond
to the methods defined on the value type. The method deserialize or
cast will be called on your type object, with raw input from the
database or from your controllers. This is useful, for example, when doing custom conversion,
like Money data.
Querying:
When ActiveRecord::Base.where is called, it will
use the type defined by the model class to convert the value to SQL,
calling serialize on your type object.
This gives the objects ability to specify, how to convert values when performing SQL queries.
Dirty Tracking:
The type of an attribute is allowed to change how dirty tracking is performed.
See its documentation for a detailed write up.
Test Runner
A new test runner has been introduced to enhance the capabilities of running tests from Rails.
To use this test runner simply type bin/rails test.
Test Runner is inspired by RSpec, minitest-reporters, maxitest and others.
It includes some of these notable advancements:
- Run a single test using line number of test.
- Run multiple tests pinpointing to line number of tests.
- Improved failure messages, which also add ease of re-running failed tests.
- Fail fast using
-foption, to stop tests immediately on occurrence of failure, instead of waiting for the suite to complete. - Defer test output until the end of a full test run using the
-doption. - Complete exception backtrace output using
-boption. - Integration with minitest to allow options like
-sfor test seed data,-nfor running specific test by name,-vfor better verbose output and so forth. - Colored test output.
Railties
Please refer to the Changelog for detailed changes.
Removals
Removed debugger support, use byebug instead.
debuggeris not supported by Ruby 2.2. (commit)Removed deprecated
test:allandtest:all:dbtasks. (commit)Removed deprecated
Rails::Rack::LogTailer. (commit)Removed deprecated
RAILS_CACHEconstant. (commit)Removed deprecated
serve_static_assetsconfiguration. (commit)Removed the documentation tasks
doc:app,doc:rails, anddoc:guides. (commit)Removed
Rack::ContentLengthmiddleware from the default stack. (Commit)
Deprecations
Deprecated
config.static_cache_controlin favor ofconfig.public_file_server.headers. (Pull Request)Deprecated
config.serve_static_filesin favor ofconfig.public_file_server.enabled. (Pull Request)Deprecated the tasks in the
railstask namespace in favor of theappnamespace. (e.g.rails:updateandrails:templatetasks are renamed toapp:updateandapp:template.) (Pull Request)
Notable changes
Added Rails test runner
bin/rails test. (Pull Request)Newly generated applications and plugins get a
README.mdin Markdown. (commit, Pull Request)Added
bin/rails restarttask to restart your Rails app by touchingtmp/restart.txt. (Pull Request)Added
bin/rails initializerstask to print out all defined initializers in the order they are invoked by Rails. (Pull Request)Added
bin/rails dev:cacheto enable or disable caching in development mode. (Pull Request)Added
bin/updatescript to update the development environment automatically. (Pull Request)Proxy Rake tasks through
bin/rails. (Pull Request, Pull Request)New applications are generated with the evented file system monitor enabled on Linux and macOS. The feature can be opted out by passing
--skip-listento the generator. (commit, commit)Generate applications with an option to log to STDOUT in production using the environment variable
RAILS_LOG_TO_STDOUT. (Pull Request)Enable HSTS with IncludeSubdomains header for new applications. (Pull Request)
The application generator writes a new file
config/spring.rb, which tells Spring to watch additional common files. (commit)Added
--skip-action-mailerto skip Action Mailer while generating new app. (Pull Request)Removed
tmp/sessionsdirectory and the clear rake task associated with it. (Pull Request)Changed
_form.html.erbgenerated by scaffold generator to use local variables. (Pull Request)Disabled autoloading of classes in production environment. (commit)
Action Pack
Please refer to the Changelog for detailed changes.
Removals
Removed
ActionDispatch::Request::Utils.deep_munge. (commit)Removed
ActionController::HideActions. (Pull Request)Removed
respond_toandrespond_withplaceholder methods, this functionality has been extracted to the responders gem. (commit)Removed deprecated assertion files. (commit)
Removed deprecated usage of string keys in URL helpers. (commit)
Removed deprecated
only_pathoption on*_pathhelpers. (commit)Removed deprecated
NamedRouteCollection#helpers. (commit)Removed deprecated support to define routes with
:tooption that doesn't contain#. (commit)Removed deprecated
ActionDispatch::Response#to_ary. (commit)Removed deprecated
ActionDispatch::Request#deep_munge. (commit)Removed deprecated
ActionDispatch::Http::Parameters#symbolized_path_parameters. (commit)Removed deprecated option
use_routein controller tests. (commit)Removed
assignsandassert_template. Both methods have been extracted into the rails-controller-testing gem. (Pull Request)
Deprecations
Deprecated all
*_filtercallbacks in favor of*_actioncallbacks. (Pull Request)Deprecated
*_via_redirectintegration test methods. Usefollow_redirect!manually after the request call for the same behavior. (Pull Request)Deprecated
AbstractController#skip_action_callbackin favor of individual skip_callback methods. (Pull Request)Deprecated
:nothingoption forrendermethod. (Pull Request)Deprecated passing first parameter as
Hashand default status code forheadmethod. (Pull Request)Deprecated using strings or symbols for middleware class names. Use class names instead. (commit)
Deprecated accessing MIME types via constants (e.g.
Mime::HTML). Use the subscript operator with a symbol instead (e.g.Mime[:html]). (Pull Request)Deprecated
redirect_to :backin favor ofredirect_back, which accepts a requiredfallback_locationargument, thus eliminating the possibility of aRedirectBackError. (Pull Request)::ActionDispatch::IntegrationTestand::ActionController::TestCasedeprecate positional arguments in favor of keyword arguments. (Pull Request)Deprecated
:controllerand:actionpath parameters. (Pull Request)Deprecated env method on controller instances. (commit)
ActionDispatch::ParamsParseris deprecated and was removed from the middleware stack. To configure the parameter parsers useActionDispatch::Request.parameter_parsers=. (commit, commit)
Notable changes
Added
::ActionController::Rendererto render arbitrary templates outside controller actions. (Pull Request)Migrating to keyword arguments syntax in
::ActionController::TestCaseand::ActionDispatch::IntegrationHTTP request methods. (Pull Request)Added
http_cache_foreverto Action Controller, so we can cache a response that never gets expired. (Pull Request)Provide friendlier access to request variants. (Pull Request)
For actions with no corresponding templates, render
head :no_contentinstead of raising an error. (Pull Request)Added the ability to override default form builder for a controller. (Pull Request)
Added support for API-only apps.
::ActionController::APIis added as a replacement of::ActionController::Basefor this kind of applications. (Pull Request)Make
::ActionController::Parametersno longer inherits from HashWithIndifferentAccess. (Pull Request)Make it easier to opt in to
config.force_sslandconfig.ssl_optionsby making them less dangerous to try and easier to disable. (Pull Request)Added the ability of returning arbitrary headers to
::ActionDispatch::Static. (Pull Request)Changed the
protect_from_forgeryprepend default tofalse. (commit)::ActionController::TestCasewill be moved to its own gem in Rails 5.1. Use::ActionDispatch::IntegrationTestinstead. (commit)Rails generates weak ETags by default. (Pull Request)
Controller actions without an explicit
rendercall and with no corresponding templates will renderhead :no_contentimplicitly instead of raising an error. (Pull Request 1, 2)Added an option for per-form CSRF tokens. (Pull Request)
Added request encoding and response parsing to integration tests. (Pull Request)
Add
ActionController#helpersto get access to the view context at the controller level. (Pull Request)Discarded flash messages get removed before storing into session. (Pull Request)
Added support for passing collection of records to
fresh_whenandstale?. (Pull Request)::ActionController::Livebecame an::ActiveSupport::Concern. That means it can't be just included in other modules without extending them with::ActiveSupport::Concernor::ActionController::Livewon't take effect in production. Some people may be using another module to include some specialWarden/Deviseauthentication failure handling code as well since the middleware can't catch a:wardenthrown by a spawned thread which is the case when using::ActionController::Live. (More details in this issue)Introduce
Response#strong_etag=and#weak_etag=and analogous options forfresh_whenandstale?. (Pull Request)
Action View
Please refer to the Changelog for detailed changes.
Removals
Removed deprecated
AbstractController::Base::parent_prefixes. (commit)Removed
ActionView::Helpers::RecordTagHelper, this functionality has been extracted to the record_tag_helper gem. (Pull Request)Removed
:rescue_formatoption fortranslatehelper since it's no longer supported by I18n. (Pull Request)
Notable Changes
Changed the default template handler from
ERBtoRaw. (commit)Collection rendering can cache and fetches multiple partials at once. (Pull Request, commit)
Added wildcard matching to explicit dependencies. (Pull Request)
Make
disable_withthe default behavior for submit tags. Disables the button on submit to prevent double submits. (Pull Request)Partial template name no longer has to be a valid Ruby identifier. (commit)
The
datetime_taghelper now generates an input tag with the type ofdatetime-local. (Pull Request)Allow blocks while rendering with the
render partial:helper. (Pull Request)
Action Mailer
Please refer to the Changelog for detailed changes.
Removals
Removed deprecated
*_pathhelpers in email views. (commit)Removed deprecated
deliveranddeliver!methods. (commit)
Notable changes
Template lookup now respects default locale and I18n fallbacks. (commit)
Added
_mailersuffix to mailers created via generator, following the same naming convention used in controllers and jobs. (Pull Request)Added
assert_enqueued_emailsandassert_no_enqueued_emails. (Pull Request)Added
config.action_mailer.deliver_later_queue_nameconfiguration to set the mailer queue name. (Pull Request)Added support for fragment caching in Action Mailer views. Added new config option
config.action_mailer.perform_cachingto determine whether your templates should perform caching or not. (Pull Request)
Active Record
Please refer to the Changelog for detailed changes.
Removals
Removed deprecated behavior allowing nested arrays to be passed as query values. (Pull Request)
Removed deprecated ActiveRecord::Tasks::DatabaseTasks#load_schema. This method was replaced by
ActiveRecord::Tasks::DatabaseTasks#load_schema_for. (commit)Removed deprecated
serialized_attributes. (commit)Removed deprecated automatic counter caches on
has_many :through. (commit)Removed deprecated
sanitize_sql_hash_for_conditions. (commit)Removed deprecated
Reflection#source_macro. (commit)Removed deprecated
symbolized_base_classandsymbolized_sti_name. (commit)Removed deprecated
ActiveRecord::Base.disable_implicit_join_references=. (commit)Removed deprecated access to connection specification using a string accessor. (commit)
Removed deprecated support to preload instance-dependent associations. (commit)
Removed deprecated support for PostgreSQL ranges with exclusive lower bounds. (commit)
Removed deprecation when modifying a relation with cached Arel. This raises an
ImmutableRelationerror instead. (commit)Removed
ActiveRecord::Serialization::XmlSerializerfrom core. This feature has been extracted into the activemodel-serializers-xml gem. (Pull Request)Removed support for the legacy
mysqldatabase adapter from core. Most users should be able to usemysql2. It will be converted to a separate gem when we find someone to maintain it. (Pull Request 1, Pull Request 2)Removed support for the
protected_attributesgem. (commit)Removed support for PostgreSQL versions below 9.1. (Pull Request)
Removed support for
activerecord-deprecated_findersgem. (commit)Removed
ActiveRecord::ConnectionAdapters::Column::TRUE_VALUESconstant. (commit)
Deprecations
Deprecated passing a class as a value in a query. Users should pass strings instead. (Pull Request)
Deprecated returning
falseas a way to halt Active Record callback chains. The recommended way is tothrow(:abort). (Pull Request)Deprecated
ActiveRecord::Base.errors_in_transactional_callbacks=. (commit)Deprecated
Relation#uniquseRelation#distinctinstead. (commit)Deprecated the PostgreSQL
:pointtype in favor of a new one which will returnPointobjects instead of anArray(Pull Request)Deprecated force association reload by passing a truthy argument to association method. (Pull Request)
Deprecated the keys for association
restrict_dependent_destroyerrors in favor of new key names. (Pull Request)Synchronize behavior of
#tables. (Pull Request)Deprecated
SchemaCache#tables,SchemaCache#table_exists?andSchemaCache#clear_table_cache!in favor of their new data source counterparts. (Pull Request)Deprecated
connection.tableson the SQLite3 and MySQL adapters. (Pull Request)Deprecated passing arguments to
#tables- the#tablesmethod of some adapters (mysql2, sqlite3) would return both tables and views while others (postgresql) just return tables. To make their behavior consistent,#tableswill return only tables in the future. (Pull Request)Deprecated
table_exists?- The#table_exists?method would check both tables and views. To make their behavior consistent with#tables,#table_exists?will check only tables in the future. (Pull Request)Deprecate sending the
offsetargument tofind_nth. Please use theoffsetmethod on relation instead. (Pull Request)Deprecated
{insert|update|delete}_sqlinDatabaseStatements. Use the{insert|update|delete}public methods instead. (Pull Request)Deprecated
use_transactional_fixturesin favor ofuse_transactional_testsfor more clarity. (Pull Request)Deprecated passing a column to
ActiveRecord::Connection#quote. (commit)Added an option
endtofind_in_batchesthat complements thestartparameter to specify where to stop batch processing. (Pull Request)
Notable changes
Added a
foreign_keyoption toreferenceswhile creating the table. (commit)New attributes API. (commit)
Added
:_prefix/:_suffixoption toenumdefinition. (Pull Request, Pull Request)Added
#cache_keyto::ActiveRecord::Relation. (Pull Request)Changed the default
nullvalue fortimestampstofalse. (commit)Added
::ActiveRecord::SecureTokenin order to encapsulate generation of unique tokens for attributes in a model usingSecureRandom. (Pull Request)Added
:if_existsoption fordrop_table. (Pull Request)Added
ActiveRecord::Base#accessed_fields, which can be used to quickly discover which fields were read from a model when you are looking to only select the data you need from the database. (commit)Added the
#ormethod on::ActiveRecord::Relation, allowing use of the OR operator to combine WHERE or HAVING clauses. (commit)Added
ActiveRecord::Base.suppressto prevent the receiver from being saved during the given block. (Pull Request)belongs_towill now trigger a validation error by default if the association is not present. You can turn this off on a per-association basis withoptional: true. Also deprecaterequiredoption in favor ofoptionalforbelongs_to. (Pull Request)Added
config.active_record.dump_schemasto configure the behavior ofdb:structure:dump. (Pull Request)Added
config.active_record.warn_on_records_fetched_greater_thanoption. (Pull Request)Added a native JSON data type support in MySQL. (Pull Request)
Added support for dropping indexes concurrently in PostgreSQL. (Pull Request)
Added
#viewsand#view_exists?methods on connection adapters. (Pull Request)Added
ActiveRecord::Base.ignored_columnsto make some columns invisible from Active Record. (Pull Request)Added
connection.data_sourcesandconnection.data_source_exists?. These methods determine what relations can be used to back Active Record models (usually tables and views). (Pull Request)Allow fixtures files to set the model class in the YAML file itself. (Pull Request)
Added ability to default to
uuidas primary key when generating database migrations. (Pull Request)Added
ActiveRecord::Relation#left_joinsandActiveRecord::Relation#left_outer_joins. (Pull Request)Added
after_{create,update,delete}_commitcallbacks. (Pull Request)Version the API presented to migration classes, so we can change parameter defaults without breaking existing migrations, or forcing them to be rewritten through a deprecation cycle. (Pull Request)
ApplicationRecordis a new superclass for all app models, analogous to app controllers subclassingApplicationControllerinstead of::ActionController::Base. This gives apps a single spot to configure app-wide model behavior. (Pull Request)Added ActiveRecord
#second_to_lastand#third_to_lastmethods. (Pull Request)Added ability to annotate database objects (tables, columns, indexes) with comments stored in database metadata for PostgreSQL & MySQL. (Pull Request)
Added prepared statements support to
mysql2adapter, for mysql2 0.4.4+, Previously this was only supported on the deprecatedmysqllegacy adapter. To enable, setprepared_statements: trueinconfig/database.yml. (Pull Request)Added ability to call ActiveRecord::Relation#update on relation objects which will run validations on callbacks on all objects in the relation. (Pull Request)
Added
:touchoption to thesavemethod so that records can be saved without updating timestamps. (Pull Request)Added expression indexes and operator classes support for PostgreSQL. (commit)
Added
:index_errorsoption to add indexes to errors of nested attributes. (Pull Request)Added support for bidirectional destroy dependencies. (Pull Request)
Added support for
after_commitcallbacks in transactional tests. (Pull Request)Added
foreign_key_exists?method to see if a foreign key exists on a table or not. (Pull Request)Added
:timeoption totouchmethod to touch records with different time than the current time. (Pull Request)Change transaction callbacks to not swallow errors. Before this change any errors raised inside a transaction callback were getting rescued and printed in the logs, unless you used the (newly deprecated)
raise_in_transactional_callbacks = trueoption.Now these errors are not rescued anymore and just bubble up, matching the behavior of other callbacks. (commit)
Active Model
Please refer to the Changelog for detailed changes.
Removals
Removed deprecated
ActiveModel::Dirty#reset_#{attribute} andActiveModel::Dirty#reset_changes. (Pull Request)Removed XML serialization. This feature has been extracted into the activemodel-serializers-xml gem. (Pull Request)
Removed
ActionController::ModelNamingmodule. (Pull Request)
Deprecations
Deprecated returning
falseas a way to halt Active Model and::ActiveModel::Validationscallback chains. The recommended way is tothrow(:abort). (Pull Request)Deprecated
ActiveModel::Errors#get,ActiveModel::Errors#setandActiveModel::Errors#[]=methods that have inconsistent behavior. (Pull Request)Deprecated the
:tokenizeroption forvalidates_length_of, in favor of plain Ruby. (Pull Request)Deprecated
ActiveModel::Errors#add_on_emptyandActiveModel::Errors#add_on_blankwith no replacement. (Pull Request)
Notable changes
Added ActiveModel::Errors#details to determine what validator has failed. (Pull Request)
Extracted
::ActiveRecord::AttributeAssignmentto::ActiveModel::AttributeAssignmentallowing to use it for any object as an includable module. (Pull Request)Added
ActiveModel::Dirty#[attr_name]_previously_changed?andActiveModel::Dirty#[attr_name]_previous_changeto improve access to recorded changes after the model has been saved. (Pull Request)Validate multiple contexts on
valid?andinvalid?at once. (Pull Request)Change
validates_acceptance_ofto accepttrueas default value apart from1. (Pull Request)
Active Job
Please refer to the Changelog for detailed changes.
Notable changes
ActiveJob::Base.deserializedelegates to the job class. This allows jobs to attach arbitrary metadata when they get serialized and read it back when they get performed. (Pull Request)Add ability to configure the queue adapter on a per job basis without affecting each other. (Pull Request)
A generated job now inherits from
app/jobs/application_job.rbby default. (Pull Request)Allow
DelayedJob,Sidekiq,qu,que, andqueue_classicto report the job id back to::ActiveJob::Baseasprovider_job_id. (Pull Request, Pull Request, commit)Implement a simple
AsyncJobprocessor and associatedAsyncAdapterthat queue jobs to aconcurrent-rubythread pool. (Pull Request)Change the default adapter from inline to async. It's a better default as tests will then not mistakenly come to rely on behavior happening synchronously. (commit)
Active Support
Please refer to the Changelog for detailed changes.
Removals
Removed deprecated
ActiveSupport::JSON::Encoding::CircularReferenceError. (commit)Removed deprecated methods
ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=andActiveSupport::JSON::Encoding.encode_big_decimal_as_string. (commit)Removed deprecated ActiveSupport::SafeBuffer#prepend. (commit)
Removed deprecated methods from
Kernel.silence_stderr,silence_stream,captureandquietly. (commit)Removed deprecated
active_support/core_ext/big_decimal/yaml_conversionsfile. (commit)Removed deprecated methods ActiveSupport::Cache::Store#instrument and
ActiveSupport::Cache::Store.instrument=. (commit)Removed deprecated
Class#superclass_delegating_accessor. Use Class#class_attribute instead. (Pull Request)Removed deprecated
ThreadSafe::Cache. UseConcurrent::Mapinstead. (Pull Request)Removed
Object#itselfas it is implemented in Ruby 2.2. (Pull Request)
Deprecations
Deprecated
MissingSourceFilein favor ofLoadError. (commit)Deprecated
alias_method_chainin favour ofModule#prependintroduced in Ruby 2.0. (Pull Request)Deprecated
ActiveSupport::Concurrency::Latchin favor ofConcurrent::CountDownLatchfrom concurrent-ruby. (Pull Request)Deprecated
:prefixoption ofnumber_to_human_sizewith no replacement. (Pull Request)Deprecated
Module#qualified_const_in favour of the builtinModule#const_methods. (Pull Request)Deprecated passing string to define callback. (Pull Request)
Deprecated
ActiveSupport::Cache::Store#namespaced_key,ActiveSupport::Cache::MemCachedStore#escape_key, andActiveSupport::Cache::FileStore#key_file_path. Usenormalize_keyinstead. (Pull Request, commit)Deprecated
ActiveSupport::Cache::LocaleCache#set_cache_valuein favor ofwrite_cache_value. (Pull Request)Deprecated passing arguments to
assert_nothing_raised. (Pull Request)Deprecated
Module.local_constantsin favor ofModule.constants(false). (Pull Request)
Notable changes
Added
#verifiedand#valid_message?methods to::ActiveSupport::MessageVerifier. (Pull Request)Changed the way in which callback chains can be halted. The preferred method to halt a callback chain from now on is to explicitly
throw(:abort). (Pull Request)New config option
config.active_support.halt_callback_chains_on_return_falseto specify whether ActiveRecord, ActiveModel, and ActiveModel::Validations callback chains can be halted by returningfalsein a 'before' callback. (Pull Request)Changed the default test order from
:sortedto:random. (commit)Added
#on_weekend?,#on_weekday?,#next_weekday,#prev_weekdaymethods toDate,Time, andDateTime. (Pull Request, Pull Request)Added
same_timeoption to#next_weekand#prev_weekforDate,Time, andDateTime. (Pull Request)Added
#prev_dayand#next_daycounterparts to#yesterdayand#tomorrowforDate,Time, andDateTime. (Pull Request)Added SecureRandom.base58 for generation of random base58 strings. (commit)
Added
file_fixtureto::ActiveSupport::TestCase. It provides a simple mechanism to access sample files in your test cases. (Pull Request)Added
#withoutonEnumerableandArrayto return a copy of an enumerable without the specified elements. (Pull Request)Added
::ActiveSupport::ArrayInquirerand Array#inquiry. (Pull Request)Added ActiveSupport::TimeZone#strptime to allow parsing times as if from a given timezone. (commit)
Added
Integer#positive?andInteger#negative?query methods in the vein ofInteger#zero?. (commit)Added a bang version to
::ActiveSupport::OrderedOptionsget methods which will raise anKeyErrorif the value is.blank?. (Pull Request)Added Time.days_in_year to return the number of days in the given year, or the current year if no argument is provided. (commit)
Added an evented file watcher to asynchronously detect changes in the application source code, routes, locales, etc. (Pull Request)
Added thread_m/cattr_accessor/reader/writer suite of methods for declaring class and module variables that live per-thread. (Pull Request)
Added Array#second_to_last and Array#third_to_last methods. (Pull Request)
Publish
::ActiveSupport::Executorand::ActiveSupport::ReloaderAPIs to allow components and libraries to manage, and participate in, the execution of application code, and the application reloading process. (Pull Request)::ActiveSupport::Durationnow supports ISO8601 formatting and parsing. (Pull Request)ActiveSupport::JSON.decode now supports parsing ISO8601 local times when
parse_json_timesis enabled. (Pull Request)ActiveSupport::JSON.decode now return
Dateobjects for date strings. (Pull Request)Added ability to
TaggedLoggingto allow loggers to be instantiated multiple times so that they don't share tags with each other. (Pull Request)
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.