1
0
Fork 0
forked from OpenNeo/impress
impress/lib/tasks/colors.rake
2014-03-27 22:28:48 -05:00

15 lines
518 B
Ruby

namespace :colors do
desc 'Create a color'
task :create, [:id, :name, :standard, :basic, :prank] => :environment do |t, args|
args.with_defaults(standard: true, basic: false, prank: false)
# TIL: ActiveRecord will convert strings to booleans automatically. Cool.
color = Color.new
color.id = args[:id]
color.name = args[:name]
color.standard = args[:standard]
color.basic = args[:basic]
color.prank = args[:prank]
color.save!
puts "Color #{color.inspect} created"
end
end