working through 15.13
This commit is contained in:
parent
feaea1636c
commit
aac108a50d
@ -0,0 +1,8 @@
|
||||
require 'sha1'
|
||||
|
||||
class ListController < ApplicationController
|
||||
def index
|
||||
@list = [1, "string", :symbol, ['list']]
|
||||
end
|
||||
|
||||
end
|
2
cookbook/015/hodgepodge/app/helpers/list_helper.rb
Normal file
2
cookbook/015/hodgepodge/app/helpers/list_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module ListHelper
|
||||
end
|
6
cookbook/015/hodgepodge/app/views/list/index.html.erb
Normal file
6
cookbook/015/hodgepodge/app/views/list/index.html.erb
Normal file
@ -0,0 +1,6 @@
|
||||
<ul style="font-family:monospace;">
|
||||
<% @list.each_with_index do |item, i| %>
|
||||
<li class="<%= i % 2 == 0 ? 'even' : 'odd' %>"><%= i %>:
|
||||
<%= SHA1.new(item.id.to_s) %></li>
|
||||
<% end %>
|
||||
</ul>
|
@ -1,4 +1,6 @@
|
||||
Hodgepodge::Application.routes.draw do
|
||||
get "list/index"
|
||||
|
||||
get "foo/count"
|
||||
get "foo/index"
|
||||
get "foo/pretty"
|
||||
|
@ -0,0 +1,9 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ListControllerTest < ActionController::TestCase
|
||||
test "should get index" do
|
||||
get :index
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,4 @@
|
||||
require 'test_helper'
|
||||
|
||||
class ListHelperTest < ActionView::TestCase
|
||||
end
|
Loading…
Reference in New Issue
Block a user