Using module methods in Rake task& model?

Hello,

I'm trying to use some methods I'm defining in a module in a model and my rake task. How can I do this? Any help would be appreciated.

I've currently got the following, but my rake task can't access the methods in my module. Instead, I get..

undefined local variable or method `report_csv_process' for #<Object:0x284f9e8>

/lib/module/order_process module order_process   def process_order(id)      #do stuff   end

/lib/tasks/ordering.rake

include order_process namespace :send_report do   task :order => :environment do      process_order(id)   end end

/app/models/segment.rb class Segment < ActiveRecord::Base   include report_csv_process

   bla bla

end

I was a little off, but still haven't quite figured it out. I currently have:

/lib/module/order_process.rb module order_process   def process_order(id)      #do stuff   end

/lib/tasks/ordering.rake

include 'order_process.rb' namespace :send_report do   task :order => :environment do      process_order(id)   end end

/app/models/segment.rb class Segment < ActiveRecord::Base   include 'report_csv_process.rb'

   bla bla

end

I tried removing the single quotes, without luck

Did you ever figure out how this is done? I'm stuck on the exact problem (trying to use some custom module code inside a rake task).

Hu? Did you not read my last post? You wrote almost exactly the same questing twice. You have to both require the file, then include the module.

###rake_file.rb require 'lib/modules/your_module_filename.rb'

namespace :your_rake_task do   include your_module_name

  #do stuff end