All pastes #839016 Raw Edit

Something

public text v1 · immutable
#839016 ·published 2007-12-30 20:20 UTC
rendered paste body
  def create
    @product = Product.new(params[:product])
    @product.company = current_user.companies.find(params[:company_id])

    respond_to do |format|
      if @product.save
        flash[:notice] = 'Product was successfully created.'
        format.html {redirect_to(my_company_path(@product.company)) }
        format.xml  {render(:xml => @product, :status => :created, :location => @product)}
      else
        format.html {PlansController.new.show} #{render(:action => "new")}
        format.xml  {render(:xml => @product.errors, :status => :unprocessable_entity)}
      end
    end
  end