ruby on rails 3 -上面的ROR代码是如何变成HTML代码的


<div class="row">
<div class="span6 offset3">
<%= form_for(:session, url: sessions_path) do |f| %>
  <%= f.label :email %>
  <%= f.text_field :email %>
  <%= f.label :password %>
  <%= f.password_field :password %>
  <%= f.submit "Sign in", class: "btn btn-large btn-primary" %>
<% end %>
<p>New user? <%= link_to "Sign up now!", signup_path %></p>

上面的Rails代码如何变得像下面的HTML代码?

<form accept-charset="UTF-8" action="/sessions" method="post">
  <div>
    <label for="session_email">Email</label>
    <input id="session_email" name="session[email]" size="30" type="text" />
  </div>
  <div>
    <label for="session_password">Password</label>
    <input id="session_password" name="session[password]" size="30" 
           type="password" />
  </div>
  <input class="btn btn-large btn-primary" name="commit" type="submit" 
       value="Sign in" />
</form>

看看Rails表单帮助器

相关内容

  • 没有找到相关文章

最新更新