diff --git a/app/views/admin/e_paper_criterias/emailer.html.erb b/app/views/admin/e_paper_criterias/emailer.html.erb index 52e59fd..5fa3393 100644 --- a/app/views/admin/e_paper_criterias/emailer.html.erb +++ b/app/views/admin/e_paper_criterias/emailer.html.erb @@ -1,4 +1,5 @@ -<% paper = @data["paper"] %> +<% paper = PaperCriteria.find(@data["paper_id"]) rescue nil %> +<% paper = @data["paper"] if paper.nil? && @data["paper"] != nil %> <% page = @data["page"] %> <% siteurl = @data["siteurl"] %> <% papers_data = @data["papers_data"] %> diff --git a/lib/tasks/e_paper_tasks.rake b/lib/tasks/e_paper_tasks.rake index 9b32fbf..982f048 100644 --- a/lib/tasks/e_paper_tasks.rake +++ b/lib/tasks/e_paper_tasks.rake @@ -23,7 +23,7 @@ namespace :epaper do Thread.new do tmp = [] emails_valid.each_slice(mail_limit).each do |slice_emails| - email = Email.new(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper" => paper, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data }, :mail_to => slice_emails) + email = Email.new(:mail_subject => paper.sending_title, :mail_lang => args[:locale], :template => "admin/e_paper_criterias/emailer", :template_data => {"paper_id" => paper.id, "page" => "http://" + domain + page, "siteurl" => "http://" + domain, "papers_data" => papers_data }, :mail_to => slice_emails.join(",")) begin email.save email.deliver