Last active
August 29, 2015 14:14
-
-
Save moreta/e2c82dddf5733661dfa6 to your computer and use it in GitHub Desktop.
rake run code for example from rails controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def call_rake(task, options = {}) | |
options[:rails_env] = Rails.env | |
args = options.map { |n, v| "#{n.to_s.upcase}='#{v}'" } | |
system "bundle exec rake #{task} #{args.join(' ')} >> #{Rails.root}/log/rake.log &" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment