Module: SmartEnum::ActiveRecordCompatibility
- Included in:
- SmartEnum
- Defined in:
- lib/smart_enum/active_record_compatibility.rb
Defined Under Namespace
Modules: ClassMethods, QueryMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/smart_enum/active_record_compatibility.rb', line 10
def self.included(base)
base.include(ActiveModel::Serialization)
base.extend(ActiveModel::Naming)
base.extend(ClassMethods)
base.extend(QueryMethods)
end
|
Instance Method Details
#_read_attribute(attribute_name) ⇒ Object
45
46
47
|
# File 'lib/smart_enum/active_record_compatibility.rb', line 45
def _read_attribute(attribute_name)
attributes.fetch(attribute_name.to_sym)
end
|
49
50
51
|
# File 'lib/smart_enum/active_record_compatibility.rb', line 49
def destroyed?
false
end
|
#marked_for_destruction? ⇒ Boolean
57
58
59
|
# File 'lib/smart_enum/active_record_compatibility.rb', line 57
def marked_for_destruction?
false
end
|
#new_record? ⇒ Boolean
53
54
55
|
# File 'lib/smart_enum/active_record_compatibility.rb', line 53
def new_record?
false
end
|
61
62
63
|
# File 'lib/smart_enum/active_record_compatibility.rb', line 61
def persisted?
true
end
|
#to_key ⇒ Object
41
42
43
|
# File 'lib/smart_enum/active_record_compatibility.rb', line 41
def to_key
[id]
end
|