Cron job calling Ruby script to interact with rails code

I’m really naive on this subject, forgive me. I need to write a cron job that will run a ruby script. The script needs to be able to access my rails code. What do I need to include/require in a .rb file to get access to teh same stuff as script/console? And where does this file have to live?