如何在 Shopify 店面的 Rails Shopify 应用页面上显示 Heroku hosted Ruby

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

我在 Rails public 上有一个 Ruby 嵌入式 Shopify 应用托管在 Heroku 上。我正在尝试通过应用程序代理从我的应用程序获取页面以显示在我的 Shopify 商店的前端。我已经在我的应用程序设置中设置了应用程序代理配置,但我唯一可以显示的页面是我应用程序 public 文件夹中的文件。但是,它们未嵌入 Shopify 主题中。

我无法修改 .htaccess 文件以将内容类型设置为 application/liquid,因为该应用托管在 Heroku 上。我尝试使用控制器操作渲染文件并在那里设置内容类型:

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

但应用程序代理似乎根本无法识别控制器。因此,我也不能使用控制器来呈现 html.erb 文件。我应该如何从我的 rails 应用中获取 html.erb 页(或 html 页)以显示在我的 shopify 主题中?

我成功了。我的设置有几个问题。 send 操作在 Shopify 控制器 (ShopifyApp::AuthenticatedController) 中使用时有效,但在从 ApplicationController 继承的控制器中使用时,完全相同的操作返回了 'wrong number of arguments (given 1, expected 0)' 错误。那里的修复是使参数对于操作是可选的。我将 'def send' 更改为 'def send(blank=nil)'。另外,我发送的是 html 文件而不是液体文件。