class Cuprum::Rails::Commands::AssignOne
Command
for assigning attributes to an ActiveRecord model.
Private Instance Methods
process(attributes:, entity:)
click to toggle source
# File lib/cuprum/rails/commands/assign_one.rb, line 51 def process(attributes:, entity:) step { validate_entity(entity) } entity.assign_attributes(attributes) entity rescue ActiveModel::UnknownAttributeError => exception error = Cuprum::Collections::Errors::ExtraAttributes.new( entity_class: record_class, extra_attributes: [exception.attribute], valid_attributes: record_class.attribute_names ) failure(error) end