lucasefe / themes_for_rails

Theme Support for Rails 3
This very same page :)
MIT License
308 stars 102 forks source link

"bundle exec rake assets:precompile" fails with themes_for_rails #55

Closed felixding closed 12 years ago

felixding commented 12 years ago

Everything went well in the development environment. But when I run "cap deploy" (or "rake assets:precompile"), Rake aborted and gave the following log:

felixding@ubuntu:~/bbq$ bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
undefined method `controller_name' for nil:NilClass
  (in /bbq/themes/cover_wall/views/partials/_shelf_data.erb)
...

The "undefined method" error was caused by the following code:

controller.controller_name

It didn't have any problem until Rake. Any hints please?

lucasefe commented 12 years ago

I use precompilation all the time. Can you tell me how are you using themes_for_rails?

Version. Configuration (of TFR).

Execute the rake task with --trace in the end, so we can get more data about the error.

felixding commented 12 years ago

It turned out the problems has something to do with the folder structure. I have fixed the issue by moving "themes" dir from Rails.root to Rails.root/app/views .