diff options
| author | mo khan <mo@mokhan.ca> | 2016-05-14 08:20:21 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2016-05-14 08:20:21 -0600 |
| commit | c7dacd83803bde00eb739cadf736efbdb7e1d77a (patch) | |
| tree | bbda107ebe4ee4c5dc8ee617a2861c93006a44f6 | |
| parent | 5016cb1091b700c13d8170474b68bf0fd7f6bfa2 (diff) | |
add gyms#show.
| -rw-r--r-- | app/controllers/gyms_controller.rb | 4 | ||||
| -rw-r--r-- | app/views/gyms/show.html.erb | 6 | ||||
| -rw-r--r-- | config/routes.rb | 2 | ||||
| -rw-r--r-- | spec/controllers/gyms_controller_spec.rb | 8 |
4 files changed, 19 insertions, 1 deletions
diff --git a/app/controllers/gyms_controller.rb b/app/controllers/gyms_controller.rb index a1249e9..a855fb6 100644 --- a/app/controllers/gyms_controller.rb +++ b/app/controllers/gyms_controller.rb @@ -8,6 +8,10 @@ class GymsController < ApplicationController ) end + def show + @gym = Gym.find(params[:id]) + end + def new @gym = Gym.new @gym.build_location diff --git a/app/views/gyms/show.html.erb b/app/views/gyms/show.html.erb new file mode 100644 index 0000000..04ffa12 --- /dev/null +++ b/app/views/gyms/show.html.erb @@ -0,0 +1,6 @@ + +<div class="row"> + <div class="large-12columns"> + <%= react_component('Comment', { author: 'mo', body: 'nice', rank: 5 }) %> + </div> +</div> diff --git a/config/routes.rb b/config/routes.rb index 7a0ce7b..5f9705b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -10,7 +10,7 @@ Rails.application.routes.draw do end resources :programs, only: [:show] resources :profiles, only: [:new, :create, :show, :edit, :update], constraints: { id: /[^\/]+/ } - resources :gyms, only: [:index, :new, :create] + resources :gyms, only: [:index, :show, :new, :create] get "/u/:id" => "profiles#show", constraints: { id: /[^\/]+/ } get "/dashboard" => "training_sessions#index", as: :dashboard get "/terms" => "static_pages#terms" diff --git a/spec/controllers/gyms_controller_spec.rb b/spec/controllers/gyms_controller_spec.rb index c41285f..70d9564 100644 --- a/spec/controllers/gyms_controller_spec.rb +++ b/spec/controllers/gyms_controller_spec.rb @@ -99,4 +99,12 @@ describe GymsController do end end end + + describe "#show" do + it 'loads the gym' do + gym = create(:gym) + get :show, id: gym.id + expect(assigns(:gym)).to eql(gym) + end + end end |
