No changes
No changes
No changes
No changes
-
Fix DateTime comparison with DateTime::Infinity object.
Rafael Mendonça França
-
Make Dependencies pass a name to NameError error.
arthurnn, Yuki Nishijima
No changes
No changes
No changes
-
Hash#deep_transform_keysandHash#deep_transform_keys!now transform hashes in nested arrays. This change also applies toHash#deep_stringify_keys,Hash#deep_stringify_keys!,Hash#deep_symbolize_keysandHash#deep_symbolize_keys!.OZAWA Sakuro
-
HashWithIndifferentAccessbetter respects#to_hashon objects it's given. In particular#update,#merge,#replaceall accept objects which respond to#to_hash, even if those objects are not Hashes directly.Currently, if
HashWithIndifferentAccess.newis given a non-Hash (even if it responds to#to_hash) that object is treated as the default value, rather than the initial keys and value. Changing that could break existing code, so it will be updated in 4.2.Peter Jaros
No changes
-
Fix parsing bugs in
XmlMiniSymbols or boolean parsing would raise an error for non string values (e.g. integers). Decimal parsing would fail due to a missing requirement.
Birkir A. Barkarson
-
Re-enable support for iterating over
DateTimerangesFixes #13667.
Prathamesh Sonpatki
-
Use
remove_possible_methodinstead ofremove_methodto avoid aNameErrorto be thrown on FreeBSD with theDateobject.Rafael Mendonça França, Robin Dupret
-
Default the new
I18n.enforce_available_localesconfig totrue, meaningI18nwill make sure that all locales passed to it must be declared in theavailable_localeslist.To disable it add the following configuration to your application:
config.i18n.enforce_available_locales = falseThis also ensures I18n configuration is properly initialized taking the new option into account, to avoid their deprecations while booting up the app.
Carlos Antonio da Silva, Yves Senn
-
Fix file descriptor being leaked on each call to
Kernel.silence_stream.Mario Visic
-
Fix
slice!deleting the default value of the hash.Antonio Santos
No changes
No changes
-
Disable the ability to iterate over Range of AS::TimeWithZone due to significant performance issues.
Bogdan Gusiev
-
Fix
ActiveSupport::Cache::FileStore#cleanupto no longer rely on missingeach_keymethod.Murray Steele
-
Ensure that autoloaded constants in all-caps nestings are marked as autoloaded.
Simon Coffey
-
Adds a new deprecation behaviour that raises an exception. Throwing this line into
config/environments/development.rb:ActiveSupport::Deprecation.behavior = :raisewill cause the application to raise an
ActiveSupport::DeprecationExceptionon deprecations.Use this for aggressive deprecation cleanups.
Xavier Noria
-
Improve
ActiveSupport::Cache::MemoryStorecache size calculation. The memory used by a key/entry pair is calculated via#cached_size:def cached_size(key, entry) key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD endThe value of
PER_ENTRY_OVERHEADis 240 bytes based on an empirical estimation for 64-bit MRI on 1.9.3 and 2.0.Fixes #11512.
Simeon Simeonov
-
Only raise
Module::DelegationErrorif it's the source of the exception.Fixes #10559.
-
Add
DateTime#usecandDateTime#nsecso thatActiveSupport::TimeWithZonekeeps sub-second resolution when wrapping aDateTimevalue.Fixes #10855.
Andrew White
-
Make
Time.at_with_coercionretain the second fraction and return local time.Fixes #11350.
Neer Friedman, Andrew White
-
Fix return value from
BacktraceCleaner#noisewhen the cleaner is configured with multiple silencers.Fixes #11030.
Mark J. Titorenko
-
Fix
ActiveSupport::Dependencies::Loadable#load_dependencycalling#blame_file!on Exceptions that do not have the Blamable mixinAndrew Kreiling
-
Override
Time.atto support the passing of Time-like values when called with a single argument.Andrew White
-
Allow Date to be compared with Time (like it was possible to compare Time with Date).
DHH
-
Deprecate multiple parameters support of
Object#in?.Brian Morearty + Carlos Antonio da Silva
-
An
ActiveSupport::Subscriberclass has been extracted fromActiveSupport::LogSubscriber, allowing you to use the event attachment API for other kinds of subscribers.Daniel Schierbeck
-
Class#class_attributeaccepts aninstance_predicateoption which defaults totrue. If set tofalsethe predicate method will not be defined.Agis Anastasopoulos
-
fast_xssupport has been removed. UseString#encode(xml: :attr). -
ActiveSupport::Notifications::Instrumenter#instrumentshould yield its payload.stopdropandrew
-
ActiveSupport::TimeWithZoneraisesNoMethodErrorin proper context. Fixes #9772.Yves Senn
-
Fix deletion of empty directories in
ActiveSupport::Cache::FileStore.Charles Jones
-
Improve singularizing a singular for multiple cases. Fixes #2608 #1825 #2395.
Example:
# Before 'address'.singularize # => 'addres' # After 'address'.singularize # => 'address'Mark McSpadden
-
Prevent
DateTime#changefrom truncating the second fraction, when seconds do not need to be changed.Chris Baynes
-
Added
ActiveSupport::TimeWithZone#to_rforTime#atcompatibility.Before this change:
Time.zone = 'Tokyo' time = Time.zone.now time == Time.at(time) # => falseAfter the change:
Time.zone = 'Tokyo' time = Time.zone.now time == Time.at(time) # => truestopdropandrew
-
ActiveSupport::NumberHelper#number_to_humanreturns the number unaltered when the given units hash does not contain the needed key, e.g. when the number provided is less than the largest key provided. Fixes #9269.Examples:
number_to_human(123, units: {}) # => 123 number_to_human(123, units: { thousand: 'k' }) # => 123Michael Hoffman
-
Added
beginning_of_minutesupport to core ext calculations forTimeandDateTime.Gagan Awhad
-
Add
:nsecdate format.Jamie Gaskins
-
ActiveSupport::Gzip.compressallows two optional arguments for compression level and strategy.Beyond
-
Modify
TimeWithZone#as_jsonto include 3 decimal places of sub-second accuracy by default, which is optional as per the ISO8601 spec, but extremely useful. Also the default behaviour ofDate#toJSON()in recent versions of Chrome, Safari and Firefox.James Harton
-
Improve
String#squishto handle Unicode whitespace. Antoine Lyset -
Standardise on
to_timereturning an instance ofTimein the local system timezone acrossString,Time,Date,DateTimeandActiveSupport::TimeWithZone.Andrew White
-
Extract
ActiveSupport::Testing::Performanceinto https://github.com/rails/rails-perftest You can add the gem to yourGemfileto keep using performance tests.gem 'rails-perftest'Yves Senn
-
Hash.from_xmlraises when it encounterstype="symbol"ortype="yaml". UseHash.from_trusted_xmlto parse this XML.CVE-2013-0156
Jeremy Kemper
-
Deprecate
assert_presentandassert_blankin favor ofassert object.blank?andassert object.present?Yves Senn
-
Change
String#to_dateto useDate.parse. This gives more consistent error messages and allows the use of partial dates."gibberish".to_date => Argument Error: invalid date "3rd Feb".to_date => Sun, 03 Feb 2013Kelly Stannard
-
Remove meaningless
ActiveSupport::FrozenObjectError, which was just an alias ofRuntimeError.Akira Matsuda
-
Introduce
assert_notto replace wartyassert !foo. Jeremy Kemper -
Prevent
Callbacks#set_callbackfrom setting the same callback twice.before_save :foo, :bar, :foowill at first call
bar, thenfoo.foowill no more be called twice.Dmitriy Kiriyenko
-
Add
ActiveSupport::Logger#silencethat works the same as the oldLogger#silenceextension.DHH
-
Remove surrogate unicode character encoding from
ActiveSupport::JSON.encodeThe encoding scheme was broken for unicode characters outside the basic multilingual plane; since json is assumed to be UTF-8, and we already force the encoding to UTF-8, simply pass through the un-encoded characters.Brett Carter
-
Deprecate
Time.time_with_date_fallback,Time.utc_timeandTime.local_time. These methods were added to handle the limited range of Ruby's nativeTimeimplementation. Those limitations no longer apply so we are deprecating them in 4.0 and they will be removed in 4.1.Andrew White
-
Deprecate
Date#to_time_in_current_zoneand addDate#in_time_zone. Andrew White -
Add
String#in_time_zonemethod to convert a string to anActiveSupport::TimeWithZone. Andrew White -
Deprecate
ActiveSupport::BasicObjectin favor ofActiveSupport::ProxyObject. This class is used for proxy classes. It avoids confusion with Ruby'sBasicObjectclass.Francesco Rodriguez
-
Patched
Marshal#loadto work with constant autoloading. Fixes autoloading with cache stores that rely onMarshal(MemCacheStoreandFileStore). Fixes #8167.Uriel Katz
-
Make
Time.zone.parseto work with JavaScript format date strings. Andrew White -
Add
DateTime#seconds_until_end_of_dayandTime#seconds_until_end_of_dayas a complement forseconds_from_midnight; useful when setting expiration times for caches, e.g.:<% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %> ...Olek Janiszewski
-
No longer proxy
ActiveSupport::Multibyte#class. Steve Klabnik -
Deprecate
ActiveSupport::TestCase#pendingmethod, useskipfrom minitest instead. Carlos Antonio da Silva -
XmlMini.with_backendnow may be safely used with threads:Thread.new do XmlMini.with_backend("REXML") { rexml_power } end Thread.new do XmlMini.with_backend("LibXML") { libxml_power } endEach thread will use it's own backend.
Nikita Afanasenko
-
Dependencies no longer trigger
Kernel#autoloadinremove_constant. Fixes #8213. Xavier Noria -
Simplify
mochaintegration and remove monkey-patches, bumpingmochato 0.13.0. James Mead -
#as_jsonisolates options when encoding a hash. Fixes #8182.Yves Senn
-
Deprecate
Hash#diffin favor of minitest's #diff. Steve Klabnik -
Kernel#capturecan catch output from subprocesses. Dmitry Vorotilin -
to_xmlconversions now use builder'stag!method instead of explicit invocation ofmethod_missing.Nikita Afanasenko
-
Fixed timezone mapping of the Solomon Islands. Steve Klabnik
-
Make callstack attribute optional in
ActiveSupport::Deprecation::Reportingmethodswarnanddeprecation_warning.Alexey Gaziev
-
Implement
HashWithIndifferentAccess#replacesokey?works correctly. David Graham -
Handle the possible permission denied errors
atomic.rbmight trigger due to itschownandchmodcalls.Daniele Sluijters
-
Hash#extract!returns only those keys that present in the receiver.{a: 1, b: 2}.extract!(:a, :x) # => {:a => 1}Mikhail Dieterle
-
Hash#extract!returns the same subclass, that the receiver is. I.e.HashWithIndifferentAccess#extract!returns aHashWithIndifferentAccessinstance.Mikhail Dieterle
-
Optimize
ActiveSupport::Cache::Entryto reduce memory and processing overhead. Brian Durand -
Tests tag the Rails log with the current test class and test case:
[SessionsControllerTest] [test_0002_sign in] Processing by SessionsController#create as HTML [SessionsControllerTest] [test_0002_sign in] ...Jeremy Kemper
-
Add
logger.push_tagsand.pop_tagsto complementlogger.tagged:class Job def before Rails.logger.push_tags :jobs, self.class.name end def after Rails.logger.pop_tags 2 end endJeremy Kemper
-
Allow delegation to the class using the
:classkeyword, replacingself.classusage:class User def self.hello "world" end delegate :hello, to: :class endMarc-Andre Lafortune
-
Date.beginning_of_weekthread local andbeginning_of_weekapplication config option added (default is Monday).Innokenty Mikhailov
-
An optional block can be passed to
config_accessorto set its default valueclass User include ActiveSupport::Configurable config_accessor :hair_colors do [:brown, :black, :blonde, :red] end end User.hair_colors # => [:brown, :black, :blonde, :red]Larry Lv
-
ActiveSupport::Benchmarkable#silencehas been deprecated due to its lack of thread safety. It will be removed without replacement in Rails 4.1.Steve Klabnik
-
An optional block can be passed to
Hash#deep_merge. The block will be invoked for each duplicated key and used to resolve the conflict.Pranas Kiziela
-
ActiveSupport::Deprecationis now a class. It is possible to create an instance of deprecator. Backwards compatibility has been preserved.You can choose which instance of the deprecator will be used.
deprecate :method_name, deprecator: deprecator_instanceYou can use
ActiveSupport::Deprecationin your gem.require 'active_support/deprecation' require 'active_support/core_ext/module/deprecation' class MyGem def self.deprecator ActiveSupport::Deprecation.new('2.0', 'MyGem') end def old_method end def new_method end deprecate old_method: :new_method, deprecator: deprecator end MyGem.new.old_method # => DEPRECATION WARNING: old_method is deprecated and will be removed from MyGem 2.0 (use new_method instead). (called from <main> at file.rb:18)Piotr Niełacny & Robert Pankowecki
-
ERB::Util.html_escapeencodes single quote as#39. Decimal form has better support in old browsers. Kalys Osmonov -
ActiveSupport::Callbacks: deprecate monkey patch of object callbacks. Using thefiltermethod like this:before_filter MyFilter.new class MyFilter def filter(controller) end endIs now deprecated with recommendation to use the corresponding filter type (
#before,#afteror#around):before_filter MyFilter.new class MyFilter def before(controller) end endBogdan Gusiev
-
An optional block can be passed to
HashWithIndifferentAccess#updateand#merge. The block will be invoked for each duplicated key, and used to resolve the conflict, thus replicating the behaviour of the corresponding methods on theHashclass.Leo Cassarani
-
Remove
jalias forERB::Util#json_escape. Thejalias is already used forActionView::Helpers::JavaScriptHelper#escape_javascriptand both modules are included in the view context that would confuse the developers.Akira Matsuda
-
Replace deprecated
memcache-clientgem withdalliinActiveSupport::Cache::MemCacheStore.Guillermo Iguaran
-
Add default values to all
ActiveSupport::NumberHelpermethods, to avoid errors with empty locales or missing values.Carlos Antonio da Silva
-
ActiveSupport::JSON::Variableis deprecated. Define your own#as_jsonand#encode_jsonmethods for custom JSON string literals.Erich Menge
-
Add
String#indent. fxn & Ace Suares -
Inflections can now be defined per locale.
singularizeandpluralizeaccept locale as an extra argument.David Celis
-
Object#trywill now returnnilinstead of raise aNoMethodErrorif the receiving object does not implement the method, but you can still get the old behavior by using the newObject#try!.DHH
-
ERB::Util.html_escapenow escapes single quotes. Santiago Pastorino -
Time#changenow works with time values with offsets other than UTC or the local time zone. Andrew White -
ActiveSupport::Callbacks: deprecate usage of filter object with#beforeand#aftermethods asaroundcallback. Bogdan Gusiev -
Add
Time#prev_quarterandTime#next_quartershort-hands formonths_ago(3)andmonths_since(3). SungHee Kang -
Remove obsolete and unused
require_associationmethod from dependencies. fxn -
Add
:instance_accessoroption forconfig_accessor.class User include ActiveSupport::Configurable config_accessor :allowed_access, instance_accessor: false end User.new.allowed_access = true # => NoMethodError User.new.allowed_access # => NoMethodErrorFrancesco Rodriguez
-
ActionView::Helpers::NumberHelpermethods have been moved toActiveSupport::NumberHelperand are now available viaNumeric#to_s.Numeric#to_snow accepts the formatting options:phone,:currency,:percentage,:delimited,:rounded,:human, and:human_size.Andrew Mutz
-
Add
Hash#transform_keys,Hash#transform_keys!,Hash#deep_transform_keys, andHash#deep_transform_keys!. Mark McSpadden -
Changed XML type
datetimetodateTime(with upper case letterT). Angelo Capilleri -
Add
:instance_accessoroption forclass_attribute. Alexey Vakhov -
constantizenow looks in the ancestor chain. Marc-Andre Lafortune & Andrew White -
Adds
Hash#deep_stringify_keysandHash#deep_stringify_keys!to convert all keys from aHashinstance into strings. Lucas Húngaro -
Adds
Hash#deep_symbolize_keysandHash#deep_symbolize_keys!to convert all keys from aHashinstance into symbols. Lucas Húngaro -
Object#trycan't call private methods. Vasiliy Ermolovich -
AS::Callbacks#run_callbacksremovekeyargument. Francesco Rodriguez -
deep_dupworks more expectedly now and duplicates also values inHashinstances and elements inArrayinstances. Alexey Gaziev -
Inflector no longer applies ice -> ouse to words like "slice", "police", etc. Wes Morgan
-
Add
ActiveSupport::Deprecations.behavior = :silenceto completely ignore Rails runtime deprecations. twinturbo -
Make
Module#delegatestop usingsend- can no longer delegate to private methods. dasch -
ActiveSupport::Callbacks: deprecate:rescuableoption. Bogdan Gusiev -
Adds
Integer#ordinalto get the ordinal suffix string of an integer. Tim Gildea -
ActiveSupport::Callbacks::per_keyoption is no longer supported. Bogdan Gusiev -
ActiveSupport::Callbacks#define_callbacks: add:skip_after_callbacks_if_terminatedoption. Bogdan Gusiev -
Add
html_escape_oncetoERB::Util, and delegate theescape_oncetag helper to it. Carlos Antonio da Silva -
Deprecates the compatibility method
Module#local_constant_names, useModule#local_constantsinstead (which returns symbols). Xavier Noria -
Deletes the compatibility method
Module#method_names, useModule#methodsfrom now on (which returns symbols). Xavier Noria -
Deletes the compatibility method
Module#instance_method_names, useModule#instance_methodsfrom now on (which returns symbols). Xavier Noria -
BufferedLoggeris deprecated. UseActiveSupport::Logger, or the logger from the Ruby standard library.Aaron Patterson
-
Unicode database updated to 6.1.0. Norman Clarke
-
Adds
encode_big_decimal_as_stringoption to force JSON serialization ofBigDecimalas numeric instead of wrapping them in strings for safety. -
Optimize log subscribers to check log level before doing any processing. Brian Durand
Please check 3-2-stable for previous changes.