Allow to configure settings with rake task

pull/1775/head
Cyril Rohr 10 years ago committed by kgalli
parent 2d0607f96e
commit 9b3ecece57
  1. 14
      lib/tasks/setting.rake

@ -0,0 +1,14 @@
namespace :setting do
desc "Allow to set a Setting: rake setting:set[key1=value1,key2=value2]"
task :set => :environment do |t,args|
args.extras.each do |tuple|
key, value = tuple.split("=")
setting = Setting.find_by_name(key)
if setting.nil?
Setting.create! name: key, value: value
else
setting.update_attributes! value: value
end
end
end
end
Loading…
Cancel
Save