Move rate tasks into a namespace

This commit is contained in:
hakanensari 2014-03-14 11:46:48 +00:00
parent 09e7502d42
commit ef70f38789

View File

@ -4,15 +4,19 @@ require 'fixer'
require 'rake/testtask'
require 'db'
task :load do
Currency.delete
data = Fixer::Feed.new(:historical)
Currency.multi_insert(data.to_a)
end
namespace :rates do
desc 'Reload all rates'
task :reload do
Currency.delete
data = Fixer::Feed.new(:historical)
Currency.multi_insert(data.to_a)
end
task :update do
Fixer::Feed.new.each do |hsh|
Currency.find_or_create(hsh)
desc 'Update rates'
task :update do
Fixer::Feed.new.each do |hsh|
Currency.find_or_create(hsh)
end
end
end