Class: Spree::Admin::RelationsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/admin/relations_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
# File 'app/controllers/spree/admin/relations_controller.rb', line 8

def create
  @relation = Relation.new(params[:relation])
  @relation.relatable = @product
  @relation.related_to = Spree::Variant.find(params[:relation][:related_to_id]).product
  @relation.save

  respond_with(@relation)
end

#destroyObject



17
18
19
20
21
22
# File 'app/controllers/spree/admin/relations_controller.rb', line 17

def destroy
  @relation = Relation.find(params[:id])
  @relation.destroy

  respond_with(@relation)
end