Skip to content

Commit

Permalink
Add User show action
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewcockerham committed Jul 4, 2013
1 parent f497a93 commit 8ee3c81
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
class UsersController < ApplicationController
def show
@user = User.find(params[:id])
@pins = @user.pins.page(params[:page]).per_page(20)
end

def new
# @user = User.new(job_experience: JobExperience.new)
# super
Expand Down
2 changes: 1 addition & 1 deletion app/views/pins/_pin.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>
<p>
<strong>
Posted by <%= pin.user.name %>
Posted by <%= link_to pin.user.name, pin.user %>
</strong>
</p>
<% if current_user == pin.user %>
Expand Down
7 changes: 7 additions & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<h1><%= @user.name %></h1>

<div id="pins">
<%= render @pins %>
</div>

<%= will_paginate @pins %>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


devise_for :users
match 'users/:id' => 'users#show', as: :user

get 'about' => 'pages#about'

Expand Down

0 comments on commit 8ee3c81

Please sign in to comment.