answers are now shown on the user page
This commit is contained in:
parent
57dc1f51c6
commit
b1a1c83163
|
@ -1,6 +1,7 @@
|
|||
class UserController < ApplicationController
|
||||
def show
|
||||
@user = User.find_by_screen_name!(params[:username])
|
||||
@answers = @user.answers.reverse_order.paginate(page: params[:page])
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
|
@ -16,3 +16,11 @@
|
|||
%span.badge#friend-count= @user.friend_count
|
||||
.col-md-9.col-xs-12.col-sm-9
|
||||
= render 'shared/questionbox'
|
||||
- @answers.each do |a|
|
||||
.panel.panel-default
|
||||
.panel-body
|
||||
%p
|
||||
%strong= a.question.content
|
||||
%small= user_screen_name a.question.user, a.question.author_is_anonymous
|
||||
%hr/
|
||||
%p= a.content
|
||||
|
|
|
@ -30,7 +30,7 @@ Rails.application.routes.draw do
|
|||
|
||||
match '/inbox', to: 'inbox#show', via: 'get'
|
||||
|
||||
match '/user/:username', to: 'user#show', via: 'get'
|
||||
match '/@:username', to: 'user#show', via: 'get', as: :show_user_profile
|
||||
match '/:username', to: 'user#show', via: 'get', as: :show_user_profile_alt
|
||||
match '/user/:username(/p/:page)', to: 'user#show', via: 'get', defaults: {page: 1}
|
||||
match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1}
|
||||
match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue