Module: ActiveRecord::Denormalize
- Included in:
- Associations::Builder::HasMany
- Defined in:
- lib/activerecord-denormalize/version.rb,
lib/active_record/denormalize.rb
Constant Summary collapse
- VERSION =
'0.2.0'
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#valid_options ⇒ Object
Support for ActiveRecord 4.
Class Method Details
.extract_attributes(obj, keys) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/active_record/denormalize.rb', line 10 def extract_attributes(obj, keys) return {} unless obj keys.each_with_object({}) {|key, hash| case key when Hash key.each do |k, v| hash[k] = v.is_a?(Proc) ? obj.instance_exec(&v) : obj.__send__(v) end else hash[key] = obj.__send__(key) end } end |
.included(builder) ⇒ Object
5 6 7 8 |
# File 'lib/active_record/denormalize.rb', line 5 def included(builder) # Support for ActiveRecord 3.2 builder. << :denormalize if builder. end |
Instance Method Details
#build ⇒ Object
26 27 28 29 30 |
# File 'lib/active_record/denormalize.rb', line 26 def build super.tap {|reflection| configure_denormalize reflection } end |
#valid_options ⇒ Object
Support for ActiveRecord 4
33 34 35 |
# File 'lib/active_record/denormalize.rb', line 33 def super + [:denormalize] end |