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