Sandeep Gudibanda
2008-Mar-24 07:03 UTC
Calling controller function from model private method
Hi, I have private methods written in my user model. I have schedule crontab to execute these methods like: ruby -e production "User.private_function" But now i will have to either access global variable of the application with in the private method or be able to call controller function through crontab! Any suggestions? Regards, Sandeep G -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sandeep Gudibanda
2008-Mar-24 07:08 UTC
Re: Calling controller function from model private method
I meant I was calling these prvate methods thru crontab : ruby script/runner -e production User.private_function Sandeep Gudibanda wrote:> Hi, > > I have private methods written in my user model. I have schedule crontab > to execute these methods like: > ruby -e production "User.private_function" > > But now i will have to either access global variable of the application > with in the private method or be able to call controller function > through crontab! > > Any suggestions? > > Regards, > Sandeep G-- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Mar-24 08:43 UTC
Re: Calling controller function from model private method
> Sandeep Gudibanda wrote: > > Hi, > > > I have private methods written in my user model. I have schedule crontab > > to execute these methods like: > > ruby -e production "User.private_function" > > > But now i will have to either access global variable of the application > > with in the private method or be able to call controller function > > through crontab!Sounds like you should rewrite your model so that it doesn''t depend on these things. A model should never be calling a controller and global variables are usually a bad idea. Fred> > > Any suggestions? > > > Regards, > > Sandeep G > > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@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 -~----------~----~----~----~------~----~------~--~---