I have a model called Contact_Email. When an email template is sent to a particular contact via ActionMailer, it is sent as part of the implementation. Save
However, I want to create a "left" action which also creates a Contact_Email, but does not send an action mailer and allows me to set a different position.
I want to take a different action because I want to give it feedback on a remote_for_ tag so that I have an AJAX button indicating it is "dropped":
Here I have to Have tried, but when it creates a Contact_Email, I get an error when I want to go back and see all the contacts. Leaving
def @contact_email = ContactEmail.new @contact_email.contact_id=params [: contact_id] @ contact_email.email_id = params [: email_id] @ contact_email.status = "left" if @ contact_email .save flash [: notice] = "email left" redirect_to contact_emails_url ending end
OK, your code looks fine, some things.
-
You do not have any more details, if your @contact email is not saved? / P>
-
You must not specify all the parameters separately Contact_email and
@contact_email = ContactEmail.new (params [contact_email]) in the
Use a scene for. Although "omitted" is specified separately, it is OK - You set the route correctly in this case
map.resources: contact_emails, member = & gt; {: Skip = & gt; : Post}
and everything should be fine
Comments
Post a Comment