Ad

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?

Ad

Answer

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.

Ad
source: stackoverflow.com
Ad