简体   繁体   中英

How to Display Heroku hosted Ruby on Rails Shopify App Page on Shopify Storefront

I have a Ruby on Rails public embedded Shopify app hosted on Heroku. I am trying to get pages from my app to appear on the front end of my Shopify store by way of an application proxy. I have already set the application proxy configurations in my app settings, but the only pages I can get to display are the files that are in the public folder of my app. However, they are not embedded within the Shopify theme.

I can't modify an .htaccess file to set the content-type to application/liquid because the app is hosted on Heroku. I tried rendering the file using a controller action and setting the content-type there:

def send
     filename = File.join(Rails.root, "/public/test.html")
     send_file(filename, :filename => "test.html", :type => 'application/liquid', :disposition => "inline")
  end   

but controllers don't seem to be recognized by the app proxy at all. As such, I can't use a controller to render an html.erb file either. How exactly am I supposed to get html.erb pages (or html pages) from my rails app to show up within my shopify theme?

I got it working. There were a couple of issues with my setup. The send action worked when used in a Shopify controller (ShopifyApp::AuthenticatedController), but the very same action returned a 'wrong number of arguments (given 1, expected 0)' error when used in a controller that inherited from ApplicationController. The fix there was to make arguments optional for the action. I changed 'def send' to 'def send(blank=nil)'. Also, I was sending an html file instead of a liquid file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM