I am working on creating a contact form for users to contact admins.
On users_controller.rb I created the method "ticketsupport":
def ticketsupport
subjectF = params[:user][:subjectsupport]
messageF = params[:user][:messagesupport]
if UserMailer.support_ticket(current_user.username, current_user.email, subjectF, messageF).deliver
flash.alert = "Your ticket has been recorderd. We will come back to you shortly."
redirect_to user_path(current_user)
end
end
On application.html.erb I created a link that unhides the bootstrap's modal:
<a href="#supportModal" data-toggle="modal">Need Help? Submit a Support Ticket</a>
<!-- Support Modal -->
<div id="supportModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="supportModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="supportModalLabel">Contact Support</h3>
</div>
<div class="modal-body">
<%= render "supportform" %>
</div>
<div class="modal-footer">
<button class="btn btn-primary">Send ticket</button>
</div>
</div>
You can find the form I render here.
And lastly, in routes added this: get "supportform" => "users#ticketsupport"
The error I get when I load the page is this: undefined method 'subjectsupport' for #<User:0x007ff5de93ed98> and it is generated when tries to load the form and its attributes.
I just want to create my custom form and pass the attributes so I can use them in the mailer.
Any idea what I am doing wrong?