Rake task is not called in production mode for ruby on rails 3
From a controller:-
call_rake :parse_venue, :venue_list_id => venue_list.id
def call_rake(task, options = {})
options[:rails_env] ||= Rails.env
args = options.map { |n, v| "#{n.to_s.upcase}='#{v}'" }
开发者_Go百科 system "rake #{task} #{args.join(' ')} --trace 2>&1 >> #{Rails.root}/log/rake.log &"
end
In development mode this rake task is triggered.. But in case of production mode its not triggered.
PS:- Inspired from rake in background, railscast. There is nothing in rake.log file in production mode
Try the following system call:
system "#{args.join(' ')} rake #{task} --trace 2>&1 >> #{Rails.root}/log/rake.log &"
Verify that "rake" is in the $PATH of the user running your web server / app server
精彩评论