现在的位置: 首页 > 综合 > 正文

Migrating to Rails 2.0.2

2012年02月19日 ⁄ 综合 ⁄ 共 927字 ⁄ 字号 评论关闭
Migrating to Rails 2.0.2

Action View
1)1.2
new.rhtml
---------
<%= form_tag :action => 'create' %>
  <%= render :partial => 'form' %>
  <%= submit_tag 'Create' %>
<%= end_form_tag %>

<%= link_to 'Back', :action => 'index' %>
=========================================
_form.rhtml
-----------
<%= error_messages_for 'author' %>
<p><label for="author_first_name">First name</label><br/>

<%= text_field 'author', 'first_name' %></p>
<p><label for="author_last_name">Last name</label><br/>

<%= text_field 'author', 'last_name' %></p>
============================================
********************************************
1)2.0.2
new.html.erb
------------
(on redflag.heroku.com/books)
<h1>New book</h1>
 
<%= error_messages_for :book %>
 
<% form_for(@book) do |f| %>
  <p>
    <b>Name</b><br />
    <%= f.text_field :name %>
  </p>
 
  <p>
    <b>Publisher</b><br />
    <%= f.text_field :publisher %>
  </p>
 
  <p>
    <b>Url</b><br />
    <%= f.text_field :url %>
  </p>
 
  <p>
    <%= f.submit "Create" %>
  </p>
<% end %>
 
<%= link_to 'Back', books_path %>
 

抱歉!评论已关闭.