This project is archived and is in readonly mode.

#5911 ✓resolved
Tom Stuart

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

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

Pages