RailsApps / rails-devise-pundit

Rails 5.0 starter app with Devise for authentication and Pundit for authorization.
http://railsapps.github.io/rails-devise-pundit/
483 stars 156 forks source link

RAILS_ENV=production rake assets:precompile - Failed to precompile #17

Closed studiorooster closed 10 years ago

studiorooster commented 10 years ago

I have been fighting with this for hours and I cannot get the app to pre-compile. It works great on my local environment, but I am trying to push it up to Heroku, but everytime I run 'RAILS_ENV=production rake assets:precompile' I get the below error. Any help would be great. Thank you.

' charles@rooster:~/apps/cfi-app$ RAILS_ENV=production rake assets:precompile rake aborted! TypeError: no implicit conversion of nil into String /home/charles/apps/cfi-app/config/initializers/devise.rb:13:in +' /home/charles/apps/cfi-app/config/initializers/devise.rb:13:inblock in <top (required)>' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/devise-3.2.4/lib/devise.rb:288:in setup' /home/charles/apps/cfi-app/config/initializers/devise.rb:3:in<top (required)>' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in load' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:inblock in load' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in load_dependency' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:inload' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/engine.rb:648:in block in load_config_initializer' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/notifications.rb:161:ininstrument' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/engine.rb:647:in load_config_initializer' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/engine.rb:612:inblock (2 levels) in class:Engine' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/engine.rb:611:in each' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/engine.rb:611:inblock in class:Engine' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/initializable.rb:30:in instance_exec' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/initializable.rb:30:inrun' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/initializable.rb:55:in block in run_initializers' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/initializable.rb:44:ineach' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/initializable.rb:44:in tsort_each_child' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/initializable.rb:54:inrun_initializers' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/application.rb:300:in initialize!' /home/charles/apps/cfi-app/config/environment.rb:5:in<top (required)>' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:in require' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:inblock in require' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in load_dependency' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:247:inrequire' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/application.rb:276:in require_environment!' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/railties-4.1.4/lib/rails/application.rb:379:inblock in run_tasks_blocks' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/gems/sprockets-rails-2.1.3/lib/sprockets/rails/task.rb:55:in block (2 levels) in define' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/bin/ruby_executable_hooks:15:ineval' /home/charles/.rvm/gems/ruby-2.1.0@cfi-app/bin/ruby_executable_hooks:15:in `

' Tasks: TOP => environment (See full trace by running task with --trace)'

DanielKehoe commented 10 years ago

Line 13 in config/initializers/devise.rb is:

  config.mailer_sender = 'no-reply@' + Rails.application.secrets.domain_name

Do you have Rails.application.secrets.domain_name set in your *config/secrets.yml` file? If you do and it still doesn't work, try hardcoding a domain name in line 13.

studiorooster commented 10 years ago

That worked, I forgot I was usign the figaro gem and didn't add DOMAIN_NAME to my application.yml file.

But now am presented with another issue. I was able to compile and even deploy to Heroku, but i am getting a H10 App Crashed error code in the logs, so my app is viewable...UGH!! Have you seen this before? Thank you for your time.

DanielKehoe commented 10 years ago

That's new to me. I suggest to ask on Stack Overflow.

anijhawan commented 10 years ago

We're you able to find a fix? I'm having the same issue

studiorooster commented 10 years ago

@anijhawan Yes everything is working great now. When you deploy to Heroku, you need to run rake manually for your database --- $ heroku run rake db:migrate

If you don't, your app will be looking for a database that is not there, hence the crash. I am a noob at all this, but I hope this helps you out.

goldnuggets24 commented 8 years ago

Thanks @DanielKehoe !! Helped me out quite a bit this afternoon.