diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-07-01 16:23:08 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-07-01 16:23:08 -0700 |
commit | d094aaad19ab0d79d0e74747ad1a7141f914b431 (patch) | |
tree | a1c1eaac7ce573a3e192eba3ef2e5ded244d93d0 /activemodel | |
parent | a444ea3478586befdc24b8152e15dc13884a3697 (diff) | |
download | rails-d094aaad19ab0d79d0e74747ad1a7141f914b431.tar.gz rails-d094aaad19ab0d79d0e74747ad1a7141f914b431.tar.bz2 rails-d094aaad19ab0d79d0e74747ad1a7141f914b431.zip |
the data structure used to store attribute aliases should not be exposed
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/attribute_methods.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb index 986a7ade81..d4d592bbbf 100644 --- a/activemodel/lib/active_model/attribute_methods.rb +++ b/activemodel/lib/active_model/attribute_methods.rb @@ -218,6 +218,16 @@ module ActiveModel end end + # Is +new_name+ an alias? + def attribute_alias?(new_name) + attribute_aliases.key? new_name.to_s + end + + # Returns the original name for the alias +name+ + def attribute_alias(name) + attribute_aliases[name.to_s] + end + # Declares the attributes that should be prefixed and suffixed by # ActiveModel::AttributeMethods. # |