I have a model called Contact_Email. When an Email template is sent through ActionMailer to a specific Contact, as part of the Create action it sends it through upon .save.
However, I want to create a "skip" action which also creates a Contact_Email, but does NOT send an ActionMailer and allows me to set the status differently.
I want to create a separate action because I want to make this respond to a remote_for_tag so that I can just have an ajax button indicate it has been "skipped":
Here's what I tried, but while it creates a Contact_Email, I end up getting an error when I want to go back and view all the Contacts again.
def skip
@contact_email = ContactEmail.new
@contact_email.contact_id = params[:contact_id]
@contact_email.email_id = params[:email_id]
@contact_email.status = "skipped"
if @contact_email.save
flash[:notice] = "skipped email"
redirect_to contact_emails_url
end
end