Module: Legato::Management::Model
- Included in:
- Account, Goal, Profile, WebProperty
- Defined in:
- lib/legato/management/model.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(model) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/legato/management/model.rb', line 5 def self.included(model) model.class_eval do attr_accessor *model::GA_ATTRIBUTES.keys attr_accessor :user, :attributes end end |
Instance Method Details
#build(attributes) ⇒ Object
19 20 21 22 23 |
# File 'lib/legato/management/model.rb', line 19 def build(attributes) self.class::GA_ATTRIBUTES.each do |key,string_key| self.send("#{key}=", attributes.delete(string_key) || attributes.delete(key)) end end |
#initialize(attributes, user) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/legato/management/model.rb', line 12 def initialize(attributes, user) self.user = user self.attributes = attributes build(attributes) end |