0

I have a simple form as follows

<% provide(:title, 'View Mail') %>
  <h1>View Mail</h1>
  <div class="row">
    <%= form_tag('/mails/new') %> 
      <%= label_tag "Email Address" %><%= email_field_tag(:email) %><br>
      <%= label_tag "Password" %><%= password_field_tag(:password) %><br>
      <%= submit_tag "View my Mails" %>
  </div>
<% end %>

What I actually want to do is capture the email and password field and forward them to another controller 'mails' so that I can use the value of email and password in that controller and then show the appropriate details.This is just a sample app for me to check something as I am new to rails.

What exactly should be in place of

<%= form_tag('/mails/new') %>
4

1 回答 1

0
<% provide(:title, 'View Mail') %>
  <h1>View Mail</h1>
  <div class="row">
    <%= form_tag('/mails/new') do %> 
    <%= label :email %>
    <%= text_field :email) %><br>
    <%= label :password %>
    <%= password_field :password %><br>
    <%= submit_tag "View my Mails" %>
    <% end %>
  </div>
<% end %>

您需要在 config/routes.db 中定义“mails/new”路径才能访问该路径。希望它能回答你的问题。

于 2013-07-10T06:17:28.923 回答