hi friend, If i am running the rake task in my rails 3 application i am getting execution expired.How to resolve this error -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 9 March 2011 11:44, anu <anuhema1989-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hi friend, > If i am running the rake task in my rails 3 application > i am getting execution expired.How to resolve this errorYou will have to give us a few more clues. Which OS are you using? Which versions of Ruby and Rails? Does rake go away for a long time before showing the error (how long)? Try adding the --trace option to rake to see if you get any useful information. If that does not help post the exact command you are entering and the *full* text of what happens. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Apr 7, 2011 at 12:58 PM, Ichiro Saga <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thank you, Bryan. It works like a charm after adding the codes you suggested! If I run the rake task in production mode, do I need to change something in the rake file? -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Thu, Apr 7, 2011 at 4:48 PM, Ichiro Saga <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Thank you, Bryan. It works like a charm after adding the codes you > suggested! If I run the rake task in production mode, do I need to > change something in the rake file? > >You''re welcome. :-) No need to change anything in file to run in production mode. A rake file will take the environment mode that the rails app is running in. If you need to run the rake file while rails is not running it''s going to look for the environment variable RAILS_ENV. Set that in your shell to the environment you want rake to run against and you''re good to go. 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Bryan Crossland wrote in post #991594:> You''re welcome. :-) No need to change anything in file to run in > production > mode. A rake file will take the environment mode that the rails app is > running in. If you need to run the rake file while rails is not running > it''s > going to look for the environment variable RAILS_ENV. Set that in your > shell > to the environment you want rake to run against and you''re good to go. > > B.Got it. Thanks again and have a nice weekend! -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.