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:
parent
58a5c84b09
commit
b90c85d510
1 changed files with 1 additions and 6 deletions
|
@ -202,17 +202,12 @@ module ActiveRecord
|
||||||
if column.nil?
|
if column.nil?
|
||||||
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
|
ActiveSupport::Deprecation.warn(<<-MESSAGE.strip_heredoc)
|
||||||
`column_for_attribute` will return a null object for non-existent columns
|
`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.
|
attribute's existence.
|
||||||
MESSAGE
|
MESSAGE
|
||||||
end
|
end
|
||||||
column
|
column
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns whether or not an attribute exists with the given name.
|
|
||||||
def attribute_exists?(name)
|
|
||||||
@attributes.include?(name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# A Person object with a name attribute can ask <tt>person.respond_to?(:name)</tt>,
|
# A Person object with a name attribute can ask <tt>person.respond_to?(:name)</tt>,
|
||||||
|
|
Loading…
Reference in a new issue