1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't add a second method for attribute existence

We already had one in the public API that people can use more easily for
the transition
This commit is contained in:
Sean Griffin 2014-06-30 11:43:34 -06:00
parent 58a5c84b09
commit b90c85d510

View file

@ -202,17 +202,12 @@ module ActiveRecord
if column.nil?
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
`column_for_attribute` will return a null object for non-existent columns
in Rails 5.0. Use `attribute_exists?` if you need to check for an
in Rails 5.0. Use `has_attribute?` if you need to check for an
attribute's existence.
MESSAGE
end
column
end
# Returns whether or not an attribute exists with the given name.
def attribute_exists?(name)
@attributes.include?(name)
end
end
# A Person object with a name attribute can ask <tt>person.respond_to?(:name)</tt>,