1
votes

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?

1
Have you tried accessing the controllers manually? You didn't mention if you verified they are working at all... - Casper
Yes, I've tried accessing the controllers manually. When I access them using the admin panel of my shopify store (or in other words, use my app as an embedded app), they work, more or less. In the admin panel, the send action that I included in my post serves up the html file for download rather than rendering it, but I think that goes back to the issue of not being able to set the content-type. - OneCaseTwoCase

1 Answers

0
votes

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.