While deploying my Rails API app to Heroku, my build is failing with the error below:
-----> Detecting rake tasks
sh: 2: Syntax error: Unterminated quoted string
sh: 2: Syntax error: Unterminated quoted string
!
! Could not detect rake tasks
! ensure you can run `$ bundle exec rake -P` against your app
! and using the production group of your Gemfile.
! rake aborted!
! NameError: uninitialized constant ApplicationPolicy
/tmp/build_64dbe116b1bd38f520ae98d49690e476/sdotapi-86210153dc2b588aa7b0dc9a60799f5090c76f46/app/policies/user_setting_policy.rb:1:in `<top (required)>'
Now, the problem is that I don't see this NameError
error on my local development box. It would seem to suggest that somehow the path for my Pundit
policies isn't getting loaded on Heroku but are happening on local box. But I am not sure why:
Here is the relevant part of my application.rb
looks like:
config.autoload_paths << Rails.root.join('lib')
Dir[Rails.root.join('app/policies/*.rb')].each &method(:require)
The line where the error was:
class UserSettingPolicy < ApplicationPolicy
Both the policy files live in app/policies
.
Any ideas on what might be going on would be super appreciated!