map.resources :users, as => 'people' do |user|
user.resources :books, :collection => {:list => :get},
:member => {:add_title => :put},
:singular => 'lala'
end
<% for book in @books %>
<tr>
<td><%= book.name %></td>
<td><%= link_to 'Show', user_lala_path(@user, book) %></td>
<td><%= link_to 'Edit', edit_user_lala_path(@user, book) %></td>
<td><%= link_to 'add_title', add_title_user_lala_path(@user, book), :method => :put %></td>
<td><%= link_to 'Destroy', user_lala_path(@user, book), :confirm => 'Are you sure?', :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to 'New book', new_user_lala_path(@user) %>
<%= link_to 'GoTo user index', users_url %>
<%= link_to 'All books', list_user_books_url(@user) %> <= plural 的還是一樣 沒變成lalas
http://localhost:25001/people/1/books <= 生出的 uri
2008年11月5日 星期三
rest, options
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言