Module: ActiveManageable::Methods::Create
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_manageable/methods/create.rb
Instance Method Summary collapse
Instance Method Details
#create(attributes:) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/active_manageable/methods/create.rb', line 10 def create(attributes:) initialize_state(attributes: attributes) @target = build_object_for_create (record: @target) model_class.transaction do yield if block_given? create_object rescue ActiveRecord::RecordInvalid false end end |