lib/legato/management/account.rb in legato-0.3.3 vs lib/legato/management/account.rb in legato-0.4.0

- old
+ new

@@ -13,19 +13,24 @@ attr_accessor :id, :name, :user def initialize(attributes, user) self.user = user - self.id = attributes['id'] - self.name = attributes['name'] + + self.id = attributes['id'] || attributes[:id] + self.name = attributes['name'] || attributes[:name] end def web_properties WebProperty.for_account(self) end def profiles Profile.for_account(self) + end + + def self.from_child(child) + all(child.user).detect {|a| a.id == child.account_id} end end end end