Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add athletes controller

  • Loading branch information...
commit 9b7fdcc76a41029837c7595443c953a6027b6de1 1 parent dc5a538
Mike Munroe authored
23 app/controllers/athletes_controller.rb
View
@@ -0,0 +1,23 @@
+class AthletesController < ApplicationController
+ # GET /athletes
+ # GET /athletes.json
+ def index
+ @athletes = Athlete.all
+
+ respond_to do |format|
+ format.html # index.html.erb
+ format.json { render json: @athletes }
+ end
+ end
+
+ # GET /athletes/1
+ # GET /athletes/1.json
+ def show
+ @athlete = Athlete.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @athlete }
+ end
+ end
+end
2  app/helpers/athletes_helper.rb
View
@@ -0,0 +1,2 @@
+module AthletesHelper
+end
17 app/views/athletes/index.html.erb
View
@@ -0,0 +1,17 @@
+<h1>Athletes</h1>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>URL</th>
+ <th>Affiliate</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @athletes.each do |athlete| %>
+ <tr>
+ <td><%= athlete.url %></td>
+ <td><%= athlete.affiliate %></td>
+ </tr>
+ <% end %>
+ </tbody>
+</table>
7 test/functional/athletes_controller_test.rb
View
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class AthletesControllerTest < ActionController::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
4 test/unit/helpers/athletes_helper_test.rb
View
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class AthletesHelperTest < ActionView::TestCase
+end
Please sign in to comment.
Something went wrong with that request. Please try again.