Skip to content

Commit

Permalink
resourced relations controller
Browse files Browse the repository at this point in the history
  • Loading branch information
citrus committed Jun 8, 2011
1 parent 2444788 commit 3a89ee2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/controllers/admin/relations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@ class Admin::RelationsController < Admin::ResourceController

before_filter :load_data, :only => :create

# [todo] fix me!
def create
@relation.relatable = @product
@relation.related_to = Variant.find(params[:relation][:related_to_id]).product
if @relation.save
render :partial => "admin/products/related_products_table", :locals => {:product => @product}, :layout => false
else
render :text => @relation.errors.inspect
end
end

private

Expand Down

0 comments on commit 3a89ee2

Please sign in to comment.