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