more crap for 15.14
This commit is contained in:
parent
7329bcdeb4
commit
36c69e95a4
@ -5,4 +5,16 @@ class ListController < ApplicationController
|
||||
@list = [1, "string", :symbol, ['list']]
|
||||
end
|
||||
|
||||
def shopping_list
|
||||
@list = [ListItem.new(4, 'aspirin'), ListItem.new(199, 'succotash')]
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
class ListItem
|
||||
attr_accessor :name, :id
|
||||
def initialize(id, name)
|
||||
@id, @name = id, name
|
||||
end
|
||||
end
|
||||
|
@ -1,2 +1,16 @@
|
||||
<h1>List#shopping_list</h1>
|
||||
<p>Find me in app/views/list/shopping_list.html.erb</p>
|
||||
<h2>My shopping list</h2>
|
||||
|
||||
<ul>
|
||||
<% @list.each do |item| %>
|
||||
<li><%= item.name %>
|
||||
<%= link_to 'Delete', {:action => 'delete', :id => item.id} %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<h2>Add new item</h2>
|
||||
|
||||
<%= form_tag :action => 'new' do %>
|
||||
<label for="product_name">Item:</label><%= text_field "product", "name" %>

|
||||
<%= submit_tag "Add new item" %>
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user