rails g task send_mail ---------- create lib/tasks/send_mail.rake ---------- namespace :send_mail do desc "ã¡ã¼ã«éä¿¡" task :mail_magazine, [:target, :id] => :environment do |task, args| target = args[:target] id = args[:id] mail_maga = MailMagazine.where( id: id ).first raise "MailMagazine Not Found" if mail_maga.blank? if target == "all" users = User.all users.each_with_index(1) { |user, i| begin Use
{{#tags}}- {{label}}
{{/tags}}