Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indexのインスタンス変数は@usersのように複数形にすべき #68

Open
JunichiIto opened this issue Jun 4, 2016 · 0 comments

Comments

@JunichiIto
Copy link
Collaborator

class AdminController < ApplicationController
  before_action :authenticate_user!
  before_action :admin_user, except: [:show]

  PER = 5
  def index
    @user = User.page(params[:page]).per(PER).all
  end

  def show
    if current_user.admin?
      @user = User.find(params[:id])
      @result = @user.results
    else
      @user = current_user
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants