Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
More atrubyonrails.org:

Ruby on Rails 5.0 Release Notes

Highlights in Rails 5.0:

  • Action Cable
  • Rails API
  • Active Record Attributes API
  • Test Runner
  • Exclusive use ofrails CLI over Rake
  • Sprockets 3
  • Turbolinks 5
  • Ruby 2.2.2+ required

These release notes cover only the major changes. To learn about various bugfixes and changes, please refer to the changelogs or check out thelist ofcommits in the main Railsrepository on GitHub.

1. Upgrading to Rails 5.0

If you're upgrading an existing application, it's a great idea to have good testcoverage before going in. You should also first upgrade to Rails 4.2 in case youhaven't and make sure your application still runs as expected before attemptingan update to Rails 5.0. A list of things to watch out for when upgrading isavailable in theUpgrading Ruby on Railsguide.

2. Major Features

2.1. Action Cable

Action Cable is a new framework in Rails 5. It seamlessly integratesWebSockets with the rest of yourRails application.

Action Cable allows for real-time features to be written in Ruby in thesame style and form as the rest of your Rails application, while still beingperformant and scalable. It's a full-stack offering that provides both aclient-side JavaScript framework and a server-side Ruby framework. You haveaccess to your full domain model written with Active Record or your ORM ofchoice.

See theAction Cable Overview guide for moreinformation.

2.2. API Applications

Rails can now be used to create slimmed down API only applications.This is useful for creating and serving APIs similar toX orGitHub API,that can be used to serve public-facing, as well as, for custom applications.

You can generate a new api Rails app using:

$railsnew my_api--api

This will do three main things:

  • Configure your application to start with a more limited set of middlewarethan normal. Specifically, it will not include any middleware primarily usefulfor browser applications (like cookies support) by default.
  • MakeApplicationController inherit fromActionController::API instead ofActionController::Base. As with middleware, this will leave out any ActionController modules that provide functionalities primarily used by browserapplications.
  • Configure the generators to skip generating views, helpers, and assets whenyou generate a new resource.

The application provides a base for APIs,that can then beconfigured to pull in functionality as suitable for the application's needs.

See theUsing Rails for API-only Applications guide for moreinformation.

2.3. 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 toActiveRecord::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.rbcreate_table:store_listings,force:truedo|t|t.decimal:price_in_centst.string:my_string,default:"original default"end
# app/models/store_listing.rbclassStoreListing<ActiveRecord::Baseend
store_listing=StoreListing.new(price_in_cents:'10.1')# beforestore_listing.price_in_cents# => BigDecimal.new(10.1)StoreListing.new.my_string# => "original default"classStoreListing<ActiveRecord::Baseattribute:price_in_cents,:integer# custom typeattribute:my_string,:string,default:"new default"# default valueattribute:my_default_proc,:datetime,default:->{Time.now}# default valueattribute:field_without_db_column,:integer,array:trueend# afterstore_listing.price_in_cents# => 10StoreListing.new.my_string# => "new default"StoreListing.new.my_default_proc# => 2015-05-30 11:04:48 -0600model=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 respondto the methods defined on the value type. The methoddeserialize orcast will be called on your type object, with raw input from thedatabase or from your controllers. This is useful, for example, when doing custom conversion,like Money data.

Querying:

WhenActiveRecord::Base.where is called, it willuse the type defined by the model class to convert the value to SQL,callingserialize 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 dirtytracking is performed.

See itsdocumentationfor a detailed write up.

2.4. Test Runner

A new test runner has been introduced to enhance the capabilities of running tests from Rails.To use this test runner simply typebin/rails test.

Test Runner is inspired byRSpec,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-f option, 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-d option.
  • Complete exception backtrace output using-b option.
  • Integration with minitest to allow options like-s for test seed data,-n for running specific test by name,-v for better verbose output and so forth.
  • Colored test output.

3. Railties

Please refer to theChangelog for detailed changes.

3.1. Removals

  • Removed debugger support, use byebug instead.debugger is not supported byRuby2.2. (commit)

  • Removed deprecatedtest:all andtest:all:db tasks.(commit)

  • Removed deprecatedRails::Rack::LogTailer.(commit)

  • Removed deprecatedRAILS_CACHE constant.(commit)

  • Removed deprecatedserve_static_assets configuration.(commit)

  • Removed the documentation tasksdoc:app,doc:rails, anddoc:guides.(commit)

  • RemovedRack::ContentLength middleware from the defaultstack. (Commit)

3.2. Deprecations

  • Deprecatedconfig.static_cache_control in favor ofconfig.public_file_server.headers.(Pull Request)

  • Deprecatedconfig.serve_static_files in favor ofconfig.public_file_server.enabled.(Pull Request)

  • Deprecated the tasks in therails task namespace in favor of theapp namespace.(e.g.rails:update andrails:template tasks are renamed toapp:update andapp:template.)(Pull Request)

3.3. Notable changes

  • Added Rails test runnerbin/rails test.(Pull Request)

  • Newly generated applications and plugins get aREADME.md in Markdown.(commit,Pull Request)

  • Addedbin/rails restart task to restart your Rails app by touchingtmp/restart.txt.(Pull Request)

  • Addedbin/rails initializers task to print out all defined initializers inthe order they are invoked by Rails.(Pull Request)

  • Addedbin/rails dev:cache to enable or disable caching in development mode.(Pull Request)

  • Addedbin/update script to update the development environment automatically.(Pull Request)

  • Proxy Rake tasks throughbin/rails.(Pull Request,Pull Request)

  • New applications are generated with the evented file system monitor enabledon Linux and macOS. The feature can be opted out by passing--skip-listen to the generator.(commit,commit)

  • Generate applications with an option to log to STDOUT in productionusing the environment variableRAILS_LOG_TO_STDOUT.(Pull Request)

  • Enable HSTS with IncludeSubdomains header for new applications.(Pull Request)

  • The application generator writes a new fileconfig/spring.rb, which tellsSpring to watch additional common files.(commit)

  • Added--skip-action-mailer to skip Action Mailer while generating new app.(Pull Request)

  • Removedtmp/sessions directory and the clear rake task associated with it.(Pull Request)

  • Changed_form.html.erb generated by scaffold generator to use local variables.(Pull Request)

  • Disabled autoloading of classes in production environment.(commit)

4. Action Pack

Please refer to theChangelog for detailed changes.

4.1. Removals

  • RemovedActionDispatch::Request::Utils.deep_munge.(commit)

  • RemovedActionController::HideActions.(Pull Request)

  • Removedrespond_to andrespond_with placeholder methods, this functionalityhas been extracted to theresponders gem.(commit)

  • Removed deprecated assertion files.(commit)

  • Removed deprecated usage of string keys in URL helpers.(commit)

  • Removed deprecatedonly_path option on*_path helpers.(commit)

  • Removed deprecatedNamedRouteCollection#helpers.(commit)

  • Removed deprecated support to define routes with:to option that doesn't contain#.(commit)

  • Removed deprecatedActionDispatch::Response#to_ary.(commit)

  • Removed deprecatedActionDispatch::Request#deep_munge.(commit)

  • Removed deprecatedActionDispatch::Http::Parameters#symbolized_path_parameters.(commit)

  • Removed deprecated optionuse_route in controller tests.(commit)

  • Removedassigns andassert_template. Both methods have been extractedinto therails-controller-testinggem.(Pull Request)

4.2. Deprecations

  • Deprecated all*_filter callbacks in favor of*_action callbacks.(Pull Request)

  • Deprecated*_via_redirect integration test methods. Usefollow_redirect!manually after the request call for the same behavior.(Pull Request)

  • DeprecatedAbstractController#skip_action_callback in favor of individualskip_callback methods.(Pull Request)

  • Deprecated:nothing option forrender method.(Pull Request)

  • Deprecated passing first parameter asHash and default status code forhead method.(Pull Request)

  • Deprecated using strings or symbols for middleware class names. Use classnames instead.(commit)

  • Deprecated accessing MIME types via constants (e.g.Mime::HTML). Use thesubscript operator with a symbol instead (e.g.Mime[:html]).(Pull Request)

  • Deprecatedredirect_to :back in favor ofredirect_back, which accepts arequiredfallback_location argument, thus eliminating the possibility of aRedirectBackError.(Pull Request)

  • ActionDispatch::IntegrationTest andActionController::TestCase deprecate positional arguments in favor ofkeyword arguments. (Pull Request)

  • Deprecated:controller and:action path parameters.(Pull Request)

  • Deprecated env method on controller instances.(commit)

  • ActionDispatch::ParamsParser is deprecated and was removed from themiddleware stack. To configure the parameter parsers useActionDispatch::Request.parameter_parsers=.(commit,commit)

4.3. Notable changes

  • AddedActionController::Renderer to render arbitrary templatesoutside controller actions.(Pull Request)

  • Migrating to keyword arguments syntax inActionController::TestCase andActionDispatch::Integration HTTP request methods.(Pull Request)

  • Addedhttp_cache_forever to Action Controller, so we can cache a responsethat never gets expired.(Pull Request)

  • Provide friendlier access to request variants.(Pull Request)

  • For actions with no corresponding templates, renderhead :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::API is added as a replacement ofActionController::Base for this kind of applications.(Pull Request)

  • MakeActionController::Parameters no longer inherits fromHashWithIndifferentAccess.(Pull Request)

  • Make it easier to opt in toconfig.force_ssl andconfig.ssl_options bymaking them less dangerous to try and easier to disable.(Pull Request)

  • Added the ability of returning arbitrary headers toActionDispatch::Static.(Pull Request)

  • Changed theprotect_from_forgery prepend default tofalse.(commit)

  • ActionController::TestCase will be moved to its own gem in Rails 5.1. UseActionDispatch::IntegrationTest instead.(commit)

  • Rails generates weak ETags by default.(Pull Request)

  • Controller actions without an explicitrender call and with nocorresponding templates will renderhead :no_content implicitlyinstead of raising an error.(Pull Request1,2)

  • Added an option for per-form CSRF tokens.(Pull Request)

  • Added request encoding and response parsing to integration tests.(Pull Request)

  • AddActionController#helpers to get access to the view contextat the controller level.(Pull Request)

  • Discarded flash messages get removed before storing into session.(Pull Request)

  • Added support for passing collection of records tofresh_when andstale?.(Pull Request)

  • ActionController::Live became anActiveSupport::Concern. Thatmeans it can't be just included in other modules without extendingthem withActiveSupport::Concern orActionController::Livewon't take effect in production. Some people may be using anothermodule to include some specialWarden/Devise authenticationfailure handling code as well since the middleware can't catch a:warden thrown by a spawned thread which is the case when usingActionController::Live.(More details in this issue)

  • IntroduceResponse#strong_etag= and#weak_etag= and analogousoptions forfresh_when andstale?.(Pull Request)

5. Action View

Please refer to theChangelog for detailed changes.

5.1. Removals

  • Removed deprecatedAbstractController::Base::parent_prefixes.(commit)

  • RemovedActionView::Helpers::RecordTagHelper, this functionalityhas been extracted to therecord_tag_helper gem.(Pull Request)

  • Removed:rescue_format option fortranslate helper since it's no longersupported by I18n.(Pull Request)

5.2. Notable Changes

  • Changed the default template handler fromERB toRaw.(commit)

  • Collection rendering can cache and fetches multiple partials at once.(Pull Request,commit)

  • Added wildcard matching to explicit dependencies.(Pull Request)

  • Makedisable_with the default behavior for submit tags. Disables thebutton on submit to prevent double submits.(Pull Request)

  • Partial template name no longer has to be a valid Ruby identifier.(commit)

  • Thedatetime_tag helper now generates an input tag with the type ofdatetime-local.(Pull Request)

  • Allow blocks while rendering with therender partial: helper.(Pull Request)

6. Action Mailer

Please refer to theChangelog for detailed changes.

6.1. Removals

  • Removed deprecated*_path helpers in email views.(commit)

  • Removed deprecateddeliver anddeliver! methods.(commit)

6.2. Notable changes

  • Template lookup now respects default locale and I18n fallbacks.(commit)

  • Added_mailer suffix to mailers created via generator, following the samenaming convention used in controllers and jobs.(Pull Request)

  • Addedassert_enqueued_emails andassert_no_enqueued_emails.(Pull Request)

  • Addedconfig.action_mailer.deliver_later_queue_name configuration to setthe mailer queue name.(Pull Request)

  • Added support for fragment caching in Action Mailer views.Added new config optionconfig.action_mailer.perform_caching to determinewhether your templates should perform caching or not.(Pull Request)

7. Active Record

Please refer to theChangelog for detailed changes.

7.1. Removals

  • Removed deprecated behavior allowing nested arrays to be passed as queryvalues. (Pull Request)

  • Removed deprecatedActiveRecord::Tasks::DatabaseTasks#load_schema. Thismethod was replaced byActiveRecord::Tasks::DatabaseTasks#load_schema_for.(commit)

  • Removed deprecatedserialized_attributes.(commit)

  • Removed deprecated automatic counter caches onhas_many :through.(commit)

  • Removed deprecatedsanitize_sql_hash_for_conditions.(commit)

  • Removed deprecatedReflection#source_macro.(commit)

  • Removed deprecatedsymbolized_base_class andsymbolized_sti_name.(commit)

  • Removed deprecatedActiveRecord::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 anImmutableRelation error instead.(commit)

  • RemovedActiveRecord::Serialization::XmlSerializer from core. This featurehas been extracted into theactivemodel-serializers-xmlgem. (Pull Request)

  • Removed support for the legacymysql database adapter from core. Most users shouldbe able to usemysql2. It will be converted to a separate gem when we find someoneto maintain it. (Pull Request 1,Pull Request 2)

  • Removed support for theprotected_attributes gem.(commit)

  • Removed support for PostgreSQL versions below 9.1.(Pull Request)

  • Removed support foractiverecord-deprecated_finders gem.(commit)

  • RemovedActiveRecord::ConnectionAdapters::Column::TRUE_VALUES constant.(commit)

7.2. Deprecations

  • Deprecated passing a class as a value in a query. Users should pass stringsinstead. (Pull Request)

  • Deprecated returningfalse as a way to halt Active Record callbackchains. The recommended way is tothrow(:abort). (Pull Request)

  • DeprecatedActiveRecord::Base.errors_in_transactional_callbacks=.(commit)

  • DeprecatedRelation#uniq useRelation#distinct instead.(commit)

  • Deprecated the PostgreSQL:point type in favor of a new one which will returnPoint objects instead of anArray(Pull Request)

  • Deprecated force association reload by passing a truthy argument toassociation method.(Pull Request)

  • Deprecated the keys for associationrestrict_dependent_destroy errors in favorof new key names.(Pull Request)

  • Synchronize behavior of#tables.(Pull Request)

  • DeprecatedSchemaCache#tables,SchemaCache#table_exists? andSchemaCache#clear_table_cache! in favor of their new data sourcecounterparts.(Pull Request)

  • Deprecatedconnection.tables on the SQLite3 and MySQL adapters.(Pull Request)

  • Deprecated passing arguments to#tables - the#tables method of someadapters (mysql2, sqlite3) would return both tables and views while others(postgresql) just return tables. To make their behavior consistent,#tables will return only tables in the future.(Pull Request)

  • Deprecatedtable_exists? - The#table_exists? method would check bothtables and views. To make their behavior consistent with#tables,#table_exists? will check only tables in the future.(Pull Request)

  • Deprecate sending theoffset argument tofind_nth. Please use theoffset method on relation instead.(Pull Request)

  • Deprecated{insert|update|delete}_sql inDatabaseStatements.Use the{insert|update|delete} public methods instead.(Pull Request)

  • Deprecateduse_transactional_fixtures in favor ofuse_transactional_tests for more clarity.(Pull Request)

  • Deprecated passing a column toActiveRecord::Connection#quote.(commit)

  • Added an optionend tofind_in_batches that complements thestartparameter to specify where to stop batch processing.(Pull Request)

7.3. Notable changes

  • Added aforeign_key option toreferences while creating the table.(commit)

  • New attributesAPI. (commit)

  • Added:_prefix/:_suffix option toenum definition.(Pull Request,Pull Request)

  • Added#cache_key toActiveRecord::Relation.(Pull Request)

  • Changed the defaultnull value fortimestamps tofalse.(commit)

  • AddedActiveRecord::SecureToken in order to encapsulate generation ofunique tokens for attributes in a model usingSecureRandom.(Pull Request)

  • Added:if_exists option fordrop_table.(Pull Request)

  • AddedActiveRecord::Base#accessed_fields, which can be used to quicklydiscover which fields were read from a model when you are looking to onlyselect the data you need from the database.(commit)

  • Added the#or method onActiveRecord::Relation, allowing use of the ORoperator to combine WHERE or HAVING clauses.(commit)

  • AddedActiveRecord::Base.suppress to prevent the receiver from being savedduring the given block.(Pull Request)

  • belongs_to will now trigger a validation error by default if theassociation is not present. You can turn this off on a per-association basiswithoptional: true. Also deprecaterequired option in favor ofoptionalforbelongs_to.(Pull Request)

  • Addedconfig.active_record.dump_schemas to configure the behavior ofdb:structure:dump.(Pull Request)

  • Addedconfig.active_record.warn_on_records_fetched_greater_than option.(Pull Request)

  • Added a native JSON data type support in MySQL.(Pull Request)

  • Added support for dropping indexes concurrently in PostgreSQL.(Pull Request)

  • Added#views and#view_exists? methods on connection adapters.(Pull Request)

  • AddedActiveRecord::Base.ignored_columns to make some columnsinvisible from Active Record.(Pull Request)

  • Addedconnection.data_sources andconnection.data_source_exists?.These methods determine what relations can be used to back Active Recordmodels (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 touuid as primary key when generating databasemigrations. (Pull Request)

  • AddedActiveRecord::Relation#left_joins andActiveRecord::Relation#left_outer_joins.(Pull Request)

  • Addedafter_{create,update,delete}_commit callbacks.(Pull Request)

  • Version the API presented to migration classes, so we can change parameterdefaults without breaking existing migrations, or forcing them to berewritten through a deprecation cycle.(Pull Request)

  • ApplicationRecord is a new superclass for all app models, analogous to appcontrollers subclassingApplicationController instead ofActionController::Base. This gives apps a single spot to configure app-widemodel behavior.(Pull Request)

  • Added ActiveRecord#second_to_last and#third_to_last methods.(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 tomysql2 adapter, for mysql2 0.4.4+,Previously this was only supported on the deprecatedmysql legacy adapter.To enable, setprepared_statements: true inconfig/database.yml.(Pull Request)

  • Added ability to callActiveRecord::Relation#update on relation objectswhich will run validations on callbacks on all objects in the relation.(Pull Request)

  • Added:touch option to thesave method so that records can be saved withoutupdating timestamps.(Pull Request)

  • Added expression indexes and operator classes support for PostgreSQL.(commit)

  • Added:index_errors option to add indexes to errors of nested attributes.(Pull Request)

  • Added support for bidirectional destroy dependencies.(Pull Request)

  • Added support forafter_commit callbacks in transactional tests.(Pull Request)

  • Addedforeign_key_exists? method to see if a foreign key exists on a tableor not.(Pull Request)

  • Added:time option totouch method to touch records with different timethan the current time.(Pull Request)

  • Change transaction callbacks to not swallow errors.Before this change any errors raised inside a transaction callbackwere getting rescued and printed in the logs, unless you usedthe (newly deprecated)raise_in_transactional_callbacks = true option.

    Now these errors are not rescued anymore and just bubble up, matching thebehavior of other callbacks.(commit)

8. Active Model

Please refer to theChangelog for detailed changes.

8.1. Removals

8.2. Deprecations

  • Deprecated returningfalse as a way to halt Active Model andActiveModel::Validations callback chains. The recommended way is tothrow(:abort). (Pull Request)

  • DeprecatedActiveModel::Errors#get,ActiveModel::Errors#set andActiveModel::Errors#[]= methods that have inconsistent behavior.(Pull Request)

  • Deprecated the:tokenizer option forvalidates_length_of, in favor ofplain Ruby.(Pull Request)

  • DeprecatedActiveModel::Errors#add_on_empty andActiveModel::Errors#add_on_blankwith no replacement.(Pull Request)

8.3. Notable changes

  • AddedActiveModel::Errors#details to determine what validator has failed.(Pull Request)

  • ExtractedActiveRecord::AttributeAssignment toActiveModel::AttributeAssignmentallowing to use it for any object as an includable module.(Pull Request)

  • AddedActiveModel::Dirty#[attr_name]_previously_changed? andActiveModel::Dirty#[attr_name]_previous_change to improve accessto recorded changes after the model has been saved.(Pull Request)

  • Validate multiple contexts onvalid? andinvalid? at once.(Pull Request)

  • Changevalidates_acceptance_of to accepttrue as default valueapart from1.(Pull Request)

9. Active Job

Please refer to theChangelog for detailed changes.

9.1. Notable changes

  • ActiveJob::Base.deserialize delegates to the job class. This allows jobsto attach arbitrary metadata when they get serialized and read it back whenthey get performed.(Pull Request)

  • Add ability to configure the queue adapter on a per job basis withoutaffecting each other.(Pull Request)

  • A generated job now inherits fromapp/jobs/application_job.rb by default.(Pull Request)

  • AllowDelayedJob,Sidekiq,qu,que, andqueue_classic to reportthe job id back toActiveJob::Base asprovider_job_id.(Pull Request,Pull Request,commit)

  • Implement a simpleAsyncJob processor and associatedAsyncAdapter thatqueue jobs to aconcurrent-ruby thread pool.(Pull Request)

  • Change the default adapter from inline to async. It's a better default astests will then not mistakenly come to rely on behavior happeningsynchronously.(commit)

10. Active Support

Please refer to theChangelog for detailed changes.

10.1. Removals

  • Removed deprecatedActiveSupport::JSON::Encoding::CircularReferenceError.(commit)

  • Removed deprecated methodsActiveSupport::JSON::Encoding.encode_big_decimal_as_string=andActiveSupport::JSON::Encoding.encode_big_decimal_as_string.(commit)

  • Removed deprecatedActiveSupport::SafeBuffer#prepend.(commit)

  • Removed deprecated methods fromKernel.silence_stderr,silence_stream,capture andquietly.(commit)

  • Removed deprecatedactive_support/core_ext/big_decimal/yaml_conversionsfile.(commit)

  • Removed deprecated methodsActiveSupport::Cache::Store.instrument andActiveSupport::Cache::Store.instrument=.(commit)

  • Removed deprecatedClass#superclass_delegating_accessor.UseClass#class_attribute instead.(Pull Request)

  • Removed deprecatedThreadSafe::Cache. UseConcurrent::Map instead.(Pull Request)

  • RemovedObject#itself as it is implemented in Ruby 2.2.(Pull Request)

10.2. Deprecations

  • DeprecatedMissingSourceFile in favor ofLoadError.(commit)

  • Deprecatedalias_method_chain in favour ofModule#prepend introduced inRuby 2.0.(Pull Request)

  • DeprecatedActiveSupport::Concurrency::Latch in favor ofConcurrent::CountDownLatch from concurrent-ruby.(Pull Request)

  • Deprecated:prefix option ofnumber_to_human_size with no replacement.(Pull Request)

  • DeprecatedModule#qualified_const_ in favour of the builtinModule#const_ methods.(Pull Request)

  • Deprecated passing string to define callback.(Pull Request)

  • DeprecatedActiveSupport::Cache::Store#namespaced_key,ActiveSupport::Cache::MemCachedStore#escape_key, andActiveSupport::Cache::FileStore#key_file_path.Usenormalize_key instead.(Pull Request,commit)

  • DeprecatedActiveSupport::Cache::LocaleCache#set_cache_value in favor ofwrite_cache_value.(Pull Request)

  • Deprecated passing arguments toassert_nothing_raised.(Pull Request)

  • DeprecatedModule.local_constants in favor ofModule.constants(false).(Pull Request)

10.3. Notable changes

  • Added#verified and#valid_message? methods toActiveSupport::MessageVerifier.(Pull Request)

  • Changed the way in which callback chains can be halted. The preferred methodto halt a callback chain from now on is to explicitlythrow(:abort).(Pull Request)

  • New config optionconfig.active_support.halt_callback_chains_on_return_false to specifywhether ActiveRecord, ActiveModel, and ActiveModel::Validations callbackchains can be halted by returningfalse in a 'before' callback.(Pull Request)

  • Changed the default test order from:sorted to:random.(commit)

  • Added#on_weekend?,#on_weekday?,#next_weekday,#prev_weekday methods toDate,Time, andDateTime.(Pull Request,Pull Request)

  • Addedsame_time option to#next_week and#prev_week forDate,Time,andDateTime.(Pull Request)

  • Added#prev_day and#next_day counterparts to#yesterday and#tomorrow forDate,Time, andDateTime.(Pull Request)

  • AddedSecureRandom.base58 for generation of random base58 strings.(commit)

  • Addedfile_fixture toActiveSupport::TestCase.It provides a simple mechanism to access sample files in your test cases.(Pull Request)

  • Added#without onEnumerable andArray to return a copy of anenumerable without the specified elements.(Pull Request)

  • AddedActiveSupport::ArrayInquirer andArray#inquiry.(Pull Request)

  • AddedActiveSupport::TimeZone#strptime to allow parsing times as iffrom a given timezone.(commit)

  • AddedInteger#positive? andInteger#negative? query methodsin the vein ofInteger#zero?.(commit)

  • Added a bang version toActiveSupport::OrderedOptions get methods which will raiseanKeyError if the value is.blank?.(Pull Request)

  • AddedTime.days_in_year to return the number of days in the given year, or thecurrent year if no argument is provided.(commit)

  • Added an evented file watcher to asynchronously detect changes in theapplication source code, routes, locales, etc.(Pull Request)

  • Added thread_m/cattr_accessor/reader/writer suite of methods for declaringclass and module variables that live per-thread.(Pull Request)

  • AddedArray#second_to_last andArray#third_to_last methods.(Pull Request)

  • PublishActiveSupport::Executor andActiveSupport::Reloader APIs to allowcomponents and libraries to manage, and participate in, the execution ofapplication code, and the application reloading process.(Pull Request)

  • ActiveSupport::Duration now supports ISO8601 formatting and parsing.(Pull Request)

  • ActiveSupport::JSON.decode now supports parsing ISO8601 local times whenparse_json_times is enabled.(Pull Request)

  • ActiveSupport::JSON.decode now returnDate objects for date strings.(Pull Request)

  • Added ability toTaggedLogging to allow loggers to be instantiated multipletimes so that they don't share tags with each other.(Pull Request)

11. Credits

See thefull list of contributors to Rails forthe many people who spent many hours making Rails, the stable and robustframework it is. Kudos to all of them.



Back to top
[8]ページ先頭

©2009-2025 Movatter.jp