find_the_right_email -> find_mail_template_by_slug

This commit is contained in:
gregoirenovel 2017-05-27 00:50:29 +02:00
parent 41b3fa62ed
commit 18d6204980

View file

@ -6,12 +6,12 @@ class Admin::MailTemplatesController < AdminController
end end
def edit def edit
@mail_template = find_the_right_mail params[:id] @mail_template = find_mail_template_by_slug(params[:id])
@mail_template_name = params[:id] @mail_template_name = params[:id]
end end
def update def update
mail_template = find_the_right_mail params[:id] mail_template = find_mail_template_by_slug(params[:id])
mail_template.update_attributes(update_params) mail_template.update_attributes(update_params)
redirect_to admin_procedure_mail_templates_path redirect_to admin_procedure_mail_templates_path
end end
@ -28,8 +28,8 @@ class Admin::MailTemplatesController < AdminController
] ]
end end
def find_the_right_mail type def find_mail_template_by_slug(slug)
mails.find { |m| m.class.slug == type } mails.find { |m| m.class.slug == slug }
end end
def update_params def update_params