e x p r e s s i c a

ruby on rails, business and technicalities

Archive for the ‘rake’ Category

To use your migrations for preparing test database create a file testdb.rake in the directory lib/tasks. Now add the following code in the lib/tasks/testdb.rake file… module Rake module TaskManager def redefine_task(task_class, args, &block) task_name, deps = resolve_args(args) task_name = task_class.scope_name(@scope, task_name) deps = [deps] unless deps.respond_to?(:to_ary) deps = deps.collect {|d|  [ Read More ]

To add a rake task to the rails application which removes all the image and audio files created by captcha, create a file named remove_captcha_files.rake in the lib/tasks directory. Add the following code to the lib/tasks/remove_captcha_files.rake file… desc "Remove captcha images and audio files" task :remove_captcha_files do image_path = "#{RAILS_ROOT}/public/images/captcha/"  [ Read More ]