Class: SpreeCmCommissioner::AgencyCategories::Create
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::AgencyCategories::Create
- Includes:
- Spree::ServiceModule::Base
- Defined in:
- app/services/spree_cm_commissioner/agency_categories/create.rb
Instance Method Summary collapse
Instance Method Details
#call(params:, current_vendor:) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/spree_cm_commissioner/agency_categories/create.rb', line 6 def call(params:, current_vendor:) taxon = Spree::Taxon.new( name: params[:name], parent_id: params[:parent_id], taxonomy_id: params[:taxonomy_id], vendor_id: current_vendor.id, description: params[:description] ) if taxon.save success(taxon: taxon) else failure(taxon, taxon.errors..join(', ')) end end |