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

I meant I was calling these prvate methods thru crontab :
ruby script/runner -e production User.private_function

Sandeep G. 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

Sandeep G. 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