This project is archived and is in readonly mode.
BlankSlate removal hasn't been backported to 2-3-stable
Reported by Tom Stuart | November 3rd, 2010 @ 08:41 AM
This
commit from 2009 replaces BlankSlate
with a less
invasive implementation in ActiveSupport::BasicObject
.
It never got backported to 2-3-stable, but it probably should
be.
For example, the implementation of
ActiveSupport::Duration
inherits from
BasicObject
so that it can delegate all "other"
methods to the duration's underlying value
. However,
because BlankSlate
doesn't even define
#send
, this causes
problems when you expect duration.foo
(actually
called on duration
) to behave the same as
duration.send(:foo)
(delegated to
duration
's underlying value
):
> helper.options_from_collection_for_select([1.day, 1.month, 1.year], :to_i, :inspect)
=> "<option value=\"86400\">86400</option>\n<option value=\"2592000\">2592000</option>\n<option value=\"31557600\">31557600.0</option>"
This is obviously the sort of problem that the removal of
BlankSlate
was intended to solve; indeed if you
cherry-pick dd15a3f onto
2-3-stable, you get the expected behaviour:
> helper.options_from_collection_for_select([1.day, 1.month, 1.year], :to_i, :inspect)
=> "<option value=\"86400\">1 day</option>\n<option value=\"2592000\">1 month</option>\n<option value=\"31557600\">1 year</option>"
Comments and changes to this ticket
-
Tom Stuart November 3rd, 2010 @ 08:49 AM
- no changes were found...
-
Repository November 3rd, 2010 @ 11:04 AM
- State changed from new to resolved
(from [44db47c63e669bdad74e4ac92a79fde13f6b839d]) Backport BlankSlate removal from ActiveSupport::BasicObject [#5911 state:resolved]
This is a backport of dd15a3fee0ded53cf91c7796e3527db366d1327a.
Signed-off-by: Andrew White andyw@pixeltrix.co.uk
https://github.com/rails/rails/commit/44db47c63e669bdad74e4ac92a79f...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 5911 BlankSlate removal hasn't been backported to 2-3-stable (from [44db47c63e669bdad74e4ac92a79fde13f6b839d]) Backpor...