2014-01-22 44 views
0

我试图添加多个应用代理位置,但尽管看起来像它允许你,但多个链接并没有保存到我的应用程序。我目前有一个表格显示正常,但在提交后我不确定如何处理它?使用Ajax提交并呈现消息?截至目前,这是我的控制者,但在提交时完全没有触及创建操作。Shopify App Proxy提交表单不会正确提交

class ProductsController < ApplicationController 
    before_filter :customer_authenticate 

    def create 
     product = Product.create(params[:product]) 
     if product.update_attribute(:shopify_id, product.set_up_product) 
      flash[:notice] = 'Product was successfully submitted' 
      redirect_to new_products_url 
     else 
      flash[:notice]= product.errors.full_messages 
      redirect_to :back 
     end 
    end 

    def new 
     if params[:shop].present? && @store = Store.find_by_shopify_url(params['shop']) 
     render layout: false, content_type: 'application/liquid' 
     else 
     flash[:notice] = 'Application is not setup with store, please try again' 
     redirect_to welcome_url 
     end 
    end 

    private 

    def customer_authenticate 
    if params['shop'] 
     store = Store.find_by_shopify_url(params['shop']) 
    else 
     store = Store.find(params[:store_id]) 
    end 
    sess = ShopifyAPI::Session.new(store.shopify_url, store.access_token) 
    ShopifyAPI::Base.activate_session(sess) 
    session[:shopify] = sess 
    end 
end 

回答

0

由于该网站通过代理访问的URL佣工没有工作,所以我必须指定像在表格下面的位置,现在工作得很好。

<%= form_for(@product, url: ENV['HOME_URL'] + "/products", method: :post, html: {multipart: true}) do |f| %>