Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

rails task arguments

namespace :rails_app do
  desc 'task with arguments'

  task :task, [:option1, :option2] => :environment do |_task, args|
    puts 'rails_app:task', args
  end
end

$> rails 'rails_app:task[1,2]
=> work: {:option1=>"1", :option1=>"2"}
 
PREVIOUS NEXT
Tagged: #rails #task #arguments
ADD COMMENT
Topic
Name
9+6 =