简体   繁体   中英

Rails Rake Assets Precompile throwing NoMethodError for Engine routes dependency

I have a sandbox app using the shopify_app engine. Routes was removed in the most recent versions of the shopify_app gem, causing the following error:

 rake aborted!
remote:        NoMethodError: undefined method `routes=' for #<ShopifyApp::Configuration:0x007fcab708e448>
remote:        /tmp/build_5d0f45fef6ff96f0e7e2e5cebd603067/config/initializers/shopify_app_initializer.rb:6:in `block in <top (required)>'
remote:        /tmp/build_5d0f45fef6ff96f0e7e2e5cebd603067/vendor/bundle/ruby/2.1.0/gems/shopify_app-6.2.1/lib/shopify_app/configuration.rb:31:in `configure'
remote:        /tmp/build_5d0f45fef6ff96f0e7e2e5cebd603067/config/initializers/shopify_app_initializer.rb:1:in `<top (required)>'

So I am trying to mount the engine in my application routes file.

Here is the rails mount line I have added in line 2, but the NoMethodError is unchanged after mounting the ShopifyApp Engine. I am not understanding the fundamental problem or how to fix it.

MyApp::Application.routes.draw do
  mount ShopifyApp::Engine => '/', as: 'shopify_app'

  controller :sessions do
    get 'login' => :new, :as => :login
    post 'login' => :create, :as => :authenticate
    get 'auth/shopify/callback' => :callback
    get 'logout' => :destroy, :as => :logout
  end

  get 'modal' => "home#modal", :as => :modal
  get 'modal_buttons' => "home#modal_buttons", :as => :modal_buttons
  get 'regular_app_page' => "home#regular_app_page"
  get 'help' => "home#help"
  get 'pagination' => "home#pagination"
  get 'breadcrumbs' => "home#breadcrumbs"
  get 'buttons' => "home#buttons"
  get 'form_page' => "home#form_page"
  post 'form_page' => "home#form_page"
  get 'error' => 'home#error'

  root :to => 'home#index'
end

Could someone please point me in the right direction? I imagine the precompile is breaking on the .routes invocation but I need help making the next leap

ShopifyApp::Engine.routes.draw do

https://github.com/Shopify/shopify_app/blob/master/config/routes.rb

我从shopify_app_initializer.rb中删除了config.routes -设置为false

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