app/controllers/users_controller.rb
# Before filters use the before_action command to arrange for a particular
# method to be called before the given actions.4 To require users to be
# logged in, we define a logged_in_user method and invoke it using
# before_action :logged_in_user
Before filters use the before_action command to arrange for a particular
method to be called before the given actions.4 To require users to be
logged in, we define a logged_in_user method and invoke it using
before_action :logged_in_user
Before filters use the before_action command to arrange for a particular method to be called before the given actions . 4 To require users to be logged in we define a logged_in_user method and invoke it using before_action : logged_in_user
def show
    @user = User.find(params[:id])
  end
def show @user = User . find ( params [ :id ] ) end
Before filters use the before_action command to arrange for a particular
method to be called before the given actions.4 To require users to be
logged in, we define a logged_in_user method and invoke it using
before_action :logged_in_user
Before filters use the before_action command to arrange for a particular method to be called before the given actions . 4 To require users to be logged in we define a logged_in_user method and invoke it using before_action : logged_in_user
# params[:id] is the string "1", # but find is smart enough to convert this to an integer. # byebug # debugger # whenever you’re confused about something in a Rails application, # it’s a good practice to put debugger close to the code you think # might be causing the trouble.