I can't execute rake task in my project. I always get the following error message:
rake aborted!
undefined method `to_sentence' for #<Array:0x10153c800>
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rails-2.3.11/lib/tasks/rails.rb:10
/Users/username/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/Users/username/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/Users/username/Documents/project/Rakefile:10
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/username/.rvm/gems/ruby-1.8.7-p334/gems/rake-0.8.7/bin/rake:31
/Users/username/.rvm/gems/ruby-1.8.7-p334/bin/rake:19:in `load'
/Users/username/.rvm/gems/ruby-1.8.7-p334/bin/rake:19
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.8.0]
Rails 2.3.11
rake, version 0.8.7
I've tried with rake 0.9.2 and/or ruby 1.9.2 without more success.
Here is the content of my Rakefile:
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, an开发者_运维技巧d they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'tasks/rails'
Thanks for your help !
If you have bundler installed try
bundle exec rake --tasks
Not sure if it will help but worth a try.
If this is a custom Rake task... the to_sentence
extension to Array is defined in Rails, so you need to ensure that you are loading Rails.
Make sure you are loading the environment in your rake task:
task :my_task => :environment do
...
If this is not a custom Rake task, then there seems to be something wrong with your environment. Try upgrading RVM.
精彩评论