# Call methods from ApplicationController from a cron job

**URL:** <https://www.ruby-forum.com/t/call-methods-from-applicationcontroller-from-a-cron-job/128767>\
**Category:** Rails\
**Created:** [February 11, 2008, 12:24pm UTC](https://www.ruby-forum.com/t/call-methods-from-applicationcontroller-from-a-cron-job/128767 "2008-02-11T12:24:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![helzer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e19b73/32.png) [@helzer](https://www.ruby-forum.com/u/helzer)\
**Post date:** [February 11, 2008, 12:24pm UTC](https://www.ruby-forum.com/t/call-methods-from-applicationcontroller-from-a-cron-job/128767/1 "2008-02-11T12:24:57Z")

</div>

Hi,

Can code in my cron job call methods from ApplicationController?  
It needs to act as if a user called a function, which triggers a whole  
lot of code that I have in the controller. I don’t want to separate  
this to a library, because this way, the controller will look pretty  
messy.

Is there any was I can require the application controller and then  
call its methods from the cron job?

What I’m getting now is just:  
NoMethodError: undefined method `create\_message\_in\_chat’ for  
#PeriodicChecker:0xb6cc7b9c

Thanks,  
Helzer
