rails 3 access to model and mailer from external script
As in topic how i can access model and mailer from ruby script? I want to do some thinks which are not web related and can't be done via rails but are bound to databa开发者_如何学Pythonse used in rails. For eg. i want to check when sb premium ends and 7 days before sand him email. Best regards
Set up a rake task which you can call and check the output of.
In lib/tasks/appname.rake
task :do_some_stuff => :environment do
# any code you want in here.
puts "some output"
end
You can then call it from the command line with
rake do_some_stuff
精彩评论