On Thu, Apr 7, 2011 at 12:58 PM, Ichiro Saga <li...@ruby-forum.com> wrote:
> Hi, guys. I wrote a rake task that called a method in model A. > in app.rake > task :update_number => :environment do > A.update_method > end > > in model A > def self.update_method > t1 = A.find.all > ... > .. > end > > When I ran the rake task, it returned an error "undefined local variable > or method t1". If I copied codes in the method to app.rake, it worked > perfectly. Did I miss something when I called the method in model from > rake? > Thanks in advance. > > Have you put the following in your rake file? require 'active_record' require 'active_record/fixtures' You need them in order for the rake file to have access to ActiveRecord. B. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.