blob: ea8c8d5f72d079ada333a50a293a87629dc17b87 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
require 'active_support/core_ext/object/instance_variables'
module ActiveModel
module Attributes
def self.append_features(base)
unless base.instance_methods.include?('attributes')
super
else
false
end
end
def attributes
instance_values
end
def read_attribute(attr_name)
instance_variable_get(:"@#{attr_name}")
end
def write_attribute(attr_name, value)
instance_variable_set(:"@#{attr_name}", value)
end
end
end
|