class ActiveShepherd::ApplyMethod
Attributes
meta_action[R]
Public Instance Methods
create?()
click to toggle source
# File lib/active_shepherd/method.rb, line 53 def create? meta_action == :_create end
destroy?()
click to toggle source
# File lib/active_shepherd/method.rb, line 57 def destroy? meta_action == :_destroy end
setup(hash)
click to toggle source
# File lib/active_shepherd/method.rb, line 61 def setup(hash) hash.each do |key, value| traversable_association = aggregate.traversable_associations[key] if traversable_association.present? associations[key] = [traversable_association, value] elsif aggregate.untraversable_association_names.include? key elsif [:_create, :_destroy].include? key @meta_action = key elsif aggregate.raw_attributes.keys.include? key.to_s attributes[key] = value else raise ActiveShepherd::AggregateMismatchError, "Attribute `#{key}' "\ "invalid for `#{aggregate.model.class.name}'" end end end