Class: ActiveRecord::Base
- Inherits:
-
Object
- Object
- ActiveRecord::Base
show all
- Includes:
- DeprecatedAttributes
- Defined in:
- lib/deprecated_attributes/active_record_extension.rb
Overview
rubocop:disable Style/ClassAndModuleChildren Override ActiveRecord arttribute_methods
Constant Summary
DeprecatedAttributes::VERSION
Instance Method Summary
collapse
configuration, configure, included, reset
Instance Method Details
#attribute_for_inspect(attr_name) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/deprecated_attributes/active_record_extension.rb', line 23
def attribute_for_inspect(attr_name)
return super unless self.class.deprecated_attributes.include?(attr_name.to_sym)
attr_name = attr_name.to_s
attr_name = self.class.attribute_aliases[attr_name] || attr_name
last_value = _read_attribute(attr_name)
value = "DEPRECATED with value: #{last_value}"
format_for_inspect(attr_name, value)
end
|
#attribute_names ⇒ Object
11
12
13
|
# File 'lib/deprecated_attributes/active_record_extension.rb', line 11
def attribute_names
self.class.attribute_names.reject { |attr| self.class.deprecated_attributes.include?(attr.to_sym) }
end
|
#serializable_hash(options = {}) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/deprecated_attributes/active_record_extension.rb', line 15
def serializable_hash(options = {})
options = {} if options.nil?
options[:only] = attributes.keys.map(&:to_sym) - (self.class.deprecated_attributes || []).map(&:to_sym)
super(options)
end
|