2013年2月9日土曜日

rails: rake aborted! uninitialized constant Movie


I got error when I try to use rake within Rails3 environment. (assume that there is a model named "Blog")


$ cat lib/tasks/test.rake
desc "mytest"
task :mytest do
  p Blog
end

$ rake mytest
rake aborted!
uninitialized constant Blog


the problem, was that I lack of ":environment" like bellow.


- task :mytest do
+ task :mytest => :environment do


I don't know why.. but anyway it works ^^;

0 件のコメント: