The user is filling out a form that's something like this:
Simplified version...
<%= form_for @email, url: email_path(@email) do |f| %>
<%= f.text_field :subject, class: "form-control" %>
<div class="tooltip-demo" style="margin-top:20px;margin-left:10px">
<%= link_to "Preview", preview_email_path, class: "btn btn-sm btn-primary preview", remote: true %>
</div>
<% end %>
In my emails controller, I have a method that looks like this:
def preview
print "Email sent!"
print params.to_json
respond_to do |format|
format.json { head :no_content }
format.js { }
end
end
How do I pass the value in the textfield :subject
to my preview method in order to validate?
This is how my route looks.. if it matters:
get :preview_email, to: "emails#preview"