Rails 4.0.10 (September 11, 2014)
Fix DateTime comparison with DateTime::Infinity object.
Rafael Mendonça França
Make Dependencies pass a name to NameError error.
arthurnn, Yuki Nishijima
Rails 4.0.9 (August 18, 2014)
No changes
Rails 4.0.8 (July 2, 2014)
No changes
Rails 4.0.7 (July 2, 2014)
No changes
Rails 4.0.6 (June 26, 2014)
Hash#deep_transform_keys
andHash#deep_transform_keys!
now transform hashes
in nested arrays. This change also applies toHash#deep_stringify_keys
,
Hash#deep_stringify_keys!
,Hash#deep_symbolize_keys
and
Hash#deep_symbolize_keys!
.OZAWA Sakuro
HashWithIndifferentAccess
better respects#to_hash
on objects it’s
given. In particular#update
,#merge
,#replace
all accept objects
which respond to#to_hash
, even if those objects are not Hashes directly.Currently, if
HashWithIndifferentAccess.new
is 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
Rails 4.0.5 (May 6, 2014)
No changes
Rails 4.0.4 (March 14, 2014)
Fix parsing bugs in
XmlMini
Symbols 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
DateTime
rangesFixes #13667.
Prathamesh Sonpatki
Use
remove_possible_method
instead ofremove_method
to avoid
aNameError
to be thrown on FreeBSD with theDate
object.Rafael Mendonça França, Robin Dupret
Default the new
I18n.enforce_available_locales
config totrue
, meaning
I18n
will make sure that all locales passed to it must be declared in the
available_locales
list.To disable it add the following configuration to your application:
config.i18n.enforce_available_locales = false
This 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
Rails 4.0.3 (February 18, 2014)
No changes
Rails 4.0.2 (December 02, 2013)
No changes
Rails 4.0.1 (November 01, 2013)
Disable the ability to iterate over Range of AS::TimeWithZone
due to significant performance issues.Bogdan Gusiev
Fix
ActiveSupport::Cache::FileStore#cleanup
to no longer rely on missingeach_key
method.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 intoconfig/environments/development.rb
:ActiveSupport::Deprecation.behavior = :raise
will cause the application to raise an
ActiveSupport::DeprecationException
on deprecations.Use this for aggressive deprecation cleanups.
Xavier Noria
Improve
ActiveSupport::Cache::MemoryStore
cache 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_OVERHEAD
is 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::DelegationError
if it’s the source of the exception.Fixes #10559.
Add
DateTime#usec
andDateTime#nsec
so thatActiveSupport::TimeWithZone
keeps
sub-second resolution when wrapping aDateTime
value.Fixes #10855.
Andrew White
Make
Time.at_with_coercion
retain the second fraction and return local time.Fixes #11350.
Neer Friedman, Andrew White
Fix return value from
BacktraceCleaner#noise
when the cleaner is configured
with multiple silencers.Fixes #11030.
Mark J. Titorenko
Fix
ActiveSupport::Dependencies::Loadable#load_dependency
calling
#blame_file!
on Exceptions that do not have the Blamable mixinAndrew Kreiling
Rails 4.0.0 (June 25, 2013)
Override
Time.at
to 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::Subscriber
class has been extracted from
ActiveSupport::LogSubscriber
, allowing you to use the event attachment
API for other kinds of subscribers.Daniel Schierbeck
Class#class_attribute
accepts aninstance_predicate
option which
defaults totrue
. If set tofalse
the predicate method will not
be defined.Agis Anastasopoulos
fast_xs
support has been removed. UseString#encode(xml: :attr)
.ActiveSupport::Notifications::Instrumenter#instrument
should
yield its payload.stopdropandrew
ActiveSupport::TimeWithZone
raisesNoMethodError
in 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#change
from truncating the second fraction, when seconds
do not need to be changed.Chris Baynes
Added
ActiveSupport::TimeWithZone#to_r
forTime#at
compatibility.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_human
returns 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_minute
support to core ext calculations forTime
andDateTime
.Gagan Awhad
Add
:nsec
date format.Jamie Gaskins
ActiveSupport::Gzip.compress
allows two optional arguments for compression
level and strategy.Beyond
Modify
TimeWithZone#as_json
to 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#squish
to handle Unicode whitespace. Antoine LysetStandardise on
to_time
returning an instance ofTime
in the local system timezone
acrossString
,Time
,Date
,DateTime
andActiveSupport::TimeWithZone
.Andrew White
Extract
ActiveSupport::Testing::Performance
into https://github.com/rails/rails-perftest
You can add the gem to yourGemfile
to keep using performance tests.gem ‘rails-perftest’
Yves Senn
Hash.from_xml
raises when it encounterstype="symbol"
ortype="yaml"
.
UseHash.from_trusted_xml
to parse this XML.CVE-2013-0156
Jeremy Kemper
Deprecate
assert_present
andassert_blank
in favor of
assert object.blank?
andassert object.present?
Yves Senn
Change
String#to_date
to 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_not
to replace wartyassert !foo
. Jeremy KemperPrevent
Callbacks#set_callback
from setting the same callback twice.before_save :foo, :bar, :foo
will at first call
bar
, thenfoo
.foo
will no more be called
twice.Dmitriy Kiriyenko
Add
ActiveSupport::Logger#silence
that works the same as the oldLogger#silence
extension.DHH
Remove surrogate unicode character encoding from
ActiveSupport::JSON.encode
The 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_time
andTime.local_time
.
These methods were added to handle the limited range of Ruby’s nativeTime
implementation. 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_zone
and addDate#in_time_zone
. Andrew WhiteAdd
String#in_time_zone
method to convert a string to anActiveSupport::TimeWithZone
. Andrew WhiteDeprecate
ActiveSupport::BasicObject
in favor ofActiveSupport::ProxyObject
.
This class is used for proxy classes. It avoids confusion with Ruby’sBasicObject
class.Francesco Rodriguez
Patched
Marshal#load
to work with constant autoloading. Fixes autoloading
with cache stores that rely onMarshal
(MemCacheStore
andFileStore
).
Fixes #8167.Uriel Katz
Make
Time.zone.parse
to work with JavaScript format date strings. Andrew WhiteAdd
DateTime#seconds_until_end_of_day
andTime#seconds_until_end_of_day
as 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 KlabnikDeprecate
ActiveSupport::TestCase#pending
method, useskip
from minitest instead. Carlos Antonio da SilvaXmlMini.with_backend
now 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#autoload
inremove_constant
. Fixes #8213. Xavier NoriaSimplify
mocha
integration and remove monkey-patches, bumpingmocha
to 0.13.0. James Mead#as_json
isolates options when encoding a hash. Fixes #8182.Yves Senn
Deprecate
Hash#diff
in favor of minitest’s #diff. Steve KlabnikKernel#capture
can catch output from subprocesses. Dmitry Vorotilinto_xml
conversions 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::Reporting
methodswarn
anddeprecation_warning
.Alexey Gaziev
Implement
HashWithIndifferentAccess#replace
sokey?
works correctly. David GrahamHandle the possible permission denied errors
atomic.rb
might trigger due to itschown
andchmod
calls.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 aHashWithIndifferentAccess
instance.Mikhail Dieterle
Optimize
ActiveSupport::Cache::Entry
to reduce memory and processing overhead. Brian DurandTests 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_tags
and.pop_tags
to complementlogger.tagged
:class Job
def before
Rails.logger.push_tags :jobs, self.class.name
enddef after
Rails.logger.pop_tags 2
end
endJeremy Kemper
Allow delegation to the class using the
:class
keyword, replacing
self.class
usage:class User
def self.hello
“world”
enddelegate :hello, to: :class
endMarc-Andre Lafortune
Date.beginning_of_week
thread local andbeginning_of_week
application
config option added (default is Monday).Innokenty Mikhailov
An optional block can be passed to
config_accessor
to set its default valueclass User
include ActiveSupport::Configurableconfig_accessor :hair_colors do
[:brown, :black, :blonde, :red]
end
endUser.hair_colors # => [:brown, :black, :blonde, :red]
Larry Lv
ActiveSupport::Benchmarkable#silence
has 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::Deprecation
is 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_instance
You can use
ActiveSupport::Deprecation
in your gem.require ‘active_support/deprecation’
require ‘active_support/core_ext/module/deprecation’class MyGem
def self.deprecator
ActiveSupport::Deprecation.new(‘2.0’, ‘MyGem’)
enddef old_method
enddef new_method
enddeprecate old_method: :new_method, deprecator: deprecator
endMyGem.new.old_method
# => DEPRECATION WARNING: old_method is deprecated and will be removed from MyGem 2.0 (use new_method instead). (called from at file.rb:18)Piotr Niełacny & Robert Pankowecki
ERB::Util.html_escape
encodes single quote as#39
. Decimal form has better support in old browsers. Kalys OsmonovActiveSupport::Callbacks
: deprecate monkey patch of object callbacks.
Using thefilter
method like this:before_filter MyFilter.new
class MyFilter
def filter(controller)
end
endIs now deprecated with recommendation to use the corresponding filter type
(#before
,#after
or#around
):before_filter MyFilter.new
class MyFilter
def before(controller)
end
endBogdan Gusiev
An optional block can be passed to
HashWithIndifferentAccess#update
and#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 theHash
class.Leo Cassarani
Remove
j
alias forERB::Util#json_escape
.
Thej
alias is already used forActionView::Helpers::JavaScriptHelper#escape_javascript
and both modules are included in the view context that would confuse the developers.Akira Matsuda
Replace deprecated
memcache-client
gem withdalli
inActiveSupport::Cache::MemCacheStore
.Guillermo Iguaran
Add default values to all
ActiveSupport::NumberHelper
methods, to avoid
errors with empty locales or missing values.Carlos Antonio da Silva
ActiveSupport::JSON::Variable
is deprecated. Define your own#as_json
and
#encode_json
methods for custom JSON string literals.Erich Menge
Add
String#indent
. fxn & Ace SuaresInflections can now be defined per locale.
singularize
andpluralize
accept locale as an extra argument.David Celis
Object#try
will now returnnil
instead of raise aNoMethodError
if 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_escape
now escapes single quotes. Santiago PastorinoTime#change
now works with time values with offsets other than UTC or the local time zone. Andrew WhiteActiveSupport::Callbacks
: deprecate usage of filter object with#before
and#after
methods asaround
callback. Bogdan GusievAdd
Time#prev_quarter
andTime#next_quarter
short-hands formonths_ago(3)
andmonths_since(3)
. SungHee KangRemove obsolete and unused
require_association
method from dependencies. fxnAdd
:instance_accessor
option forconfig_accessor
.class User
include ActiveSupport::Configurable
config_accessor :allowed_access, instance_accessor: false
endUser.new.allowed_access = true # => NoMethodError
User.new.allowed_access # => NoMethodErrorFrancesco Rodriguez
ActionView::Helpers::NumberHelper
methods have been moved toActiveSupport::NumberHelper
and are now available via
Numeric#to_s
.Numeric#to_s
now 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 McSpaddenChanged XML type
datetime
todateTime
(with upper case letterT
). Angelo CapilleriAdd
:instance_accessor
option forclass_attribute
. Alexey Vakhovconstantize
now looks in the ancestor chain. Marc-Andre Lafortune & Andrew WhiteAdds
Hash#deep_stringify_keys
andHash#deep_stringify_keys!
to convert all keys from aHash
instance into strings. Lucas HúngaroAdds
Hash#deep_symbolize_keys
andHash#deep_symbolize_keys!
to convert all keys from aHash
instance into symbols. Lucas HúngaroObject#try
can’t call private methods. Vasiliy ErmolovichAS::Callbacks#run_callbacks
removekey
argument. Francesco Rodriguezdeep_dup
works more expectedly now and duplicates also values inHash
instances and elements inArray
instances. Alexey GazievInflector no longer applies ice -> ouse to words like “slice”, “police”, etc. Wes Morgan
Add
ActiveSupport::Deprecations.behavior = :silence
to completely ignore Rails runtime deprecations. twinturboMake
Module#delegate
stop usingsend
- can no longer delegate to private methods. daschActiveSupport::Callbacks
: deprecate:rescuable
option. Bogdan GusievAdds
Integer#ordinal
to get the ordinal suffix string of an integer. Tim GildeaActiveSupport::Callbacks
::per_key
option is no longer supported. Bogdan GusievActiveSupport::Callbacks#define_callbacks
: add:skip_after_callbacks_if_terminated
option. Bogdan GusievAdd
html_escape_once
toERB::Util
, and delegate theescape_once
tag helper to it. Carlos Antonio da SilvaDeprecates the compatibility method
Module#local_constant_names
,
useModule#local_constants
instead (which returns symbols). Xavier NoriaDeletes the compatibility method
Module#method_names
,
useModule#methods
from now on (which returns symbols). Xavier NoriaDeletes the compatibility method
Module#instance_method_names
,
useModule#instance_methods
from now on (which returns symbols). Xavier NoriaBufferedLogger
is 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_string
option to force JSON serialization ofBigDecimal
as 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.