Module: ActivityNotification::Association
- Extended by:
- ActiveSupport::Concern
- Included in:
- ORM::Dynamoid::Notification, ORM::Dynamoid::Subscription, ORM::Mongoid::Notification, ORM::Mongoid::Subscription
- Defined in:
- lib/activity_notification/orm/mongoid.rb,
lib/activity_notification/orm/dynamoid.rb,
lib/activity_notification/orm/active_record.rb
Instance Method Summary collapse
-
#update(attributes) ⇒ Object
Defines update method as update_attributes method.
Instance Method Details
#update(attributes) ⇒ Object
Defines update method as update_attributes method
95 96 97 98 99 100 101 102 |
# File 'lib/activity_notification/orm/dynamoid.rb', line 95 def update(attributes) attributes_with_association = attributes.map { |attribute, value| self.class._associated_composite_records.include?(attribute) ? ["#{attribute}_key".to_sym, value.nil? ? nil : "#{value.class.name}#{ActivityNotification.config.composite_key_delimiter}#{value.id}"] : [attribute, value] }.to_h update_attributes(attributes_with_association) end |