Mario Zigliotto
Mario Zigliotto

Reputation: 9025

Where to Rake Task specific classes live? (Rails 3)

I have a couple classes that are used only by a rake task. I realize that rake tasks normally live @ lib/tasks/whatever.rake but where should i place the supporting classes?

Thank you!

Upvotes: 6

Views: 1487

Answers (2)

rnicholson
rnicholson

Reputation: 4588

$RAILS_ROOT/lib or $RAILS_ROOT/lib/special_task/ would probably be the best as its in the default load path and you can do a simple require 'my_task_helper' or require 'special_task/helper' respectively.

Upvotes: 1

Maurício Linhares
Maurício Linhares

Reputation: 40333

Directly inside "lib", if you're loading the Rails environment for the tasks.

You can also make them plugins if there are too many of them.

Upvotes: 1

Related Questions