How to write and call helpers from server/console?

I need a helper function to read cvs data into my database. I do not
need this function later in the web application.

My idea was to write a function inside a controller or AcriveRecord
class. But I dont get it called via server/console.

How do do this?

Fritz Trapper wrote:

I need a helper function to read cvs data into my database. I do not
need this function later in the web application.

My idea was to write a function inside a controller or AcriveRecord
class. But I dont get it called via server/console.

How do do this?

Make it a migration?

Ar Chron wrote:

Make it a migration?

A migration to import data?

I want to run an arbitrary function in the context of my application.

Fritz Trapper wrote:

I need a helper function to read cvs data into my database. I do not
need this function later in the web application.

My idea was to write a function inside a controller or AcriveRecord
class.

These are both probably the wrong place for it. You probably want a
non-AR class or module to hold at least some of the code.

But I dont get it called via server/console.

How do do this?

You may have to load the relevant class or include the relevant module.
But it probably should be a Rake task...

Best,