views:

52

answers:

3

Hi, I moved a Rails 2.3 application to Rails 3. The application actually works perfectly, but I have issue with rake tasks. It looks like the config in the environment file is not initialized correctly. the error I get is:

rake aborted!
undefined method `cache_classes=' for #<Hash:0x3c3e850>
/var/www/apps/nzar3/config/environments/development.rb:9
.....

The environment file is clean, and it works. Here the environments/development.rb

config.cache_classes = false
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs                         = true
config.action_controller.perform_caching             = false
config.active_support.deprecation = :log
config.action_dispatch.best_standards_support = :builtin

Any clue?

A: 

Rails3 uses a different syntax for configuration of your application.

YourApp::Application.configure do
  config.cache_classes = false
end

Did you migrate your app by running rails /path/to/rails2/app?

Have a read of this good article for tips about upgrading to Rails 3.

nfm
yeah mate, I forgot that sectionI have it in the congif fileAppxxx::Application.configure do ...
CLod
I created a brand new app rails 3 and migrated pieces
CLod
I mean, I already had the configuration correctly set up. I just didn't post here
CLod
A: 

Full config file

App::Application.configure do
 config.cache_classes = false
 config.whiny_nils = true
 config.action_controller.consider_all_requests_local = true
 config.action_view.debug_rjs                         = true
 config.action_controller.perform_caching             = false
 config.active_support.deprecation = :log
 config.action_dispatch.best_standards_support = :builtin
end
CLod
A: 

I found out that it's only this rake task that uses ActionView doesn't work

namespace :cached_assets do
  desc "Regenerate aggregate/cached files"
  task :regenerate => :environment do
    include ActionView::Helpers::TagHelper
    include ActionView::Helpers::UrlHelper
    include ActionView::Helpers::AssetTagHelper
    stylesheet_link_tag :all, :cache => 'a'
    javascript_include_tag :defaults, :cache => 'b'
    javascript_include_tag "c.js", :cache => 'c'
  end
 end
CLod