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
|
||||
|
|
|
@ -15,4 +15,12 @@
|
|||
Followings
|
||||
%span.badge#friend-count= @user.friend_count
|
||||
.col-md-9.col-xs-12.col-sm-9
|
||||
= render 'shared/questionbox'
|
||||
= 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