Topic: Refactoring a rake-task
to populate my database I wrote a little rake task using Ryan's populator gem, which looks like that:
# populate.rake namespace :db do desc "Erase and fill the database" task :populate => :environment do # Get the new populator gem require 'populator' ... do some fancy stuff ... end end
Within that task I need to have a random int between min and max, so I would like to use a method like this
def range_rand(min, max) min + rand(max - min) end
As I am very new to Rails, I am not sure, where to place that method to. Any hint welcome!
Thanks a lot!