title: Confused about how rails find the actions that does not in current controller?
body: <p>This might be a dumb question, please forgive me. I am new to Rails and I google how to locate the actions that not included in current controller but could not figure it out. I noticed that Rails follows the inheritance characteristic. I am confused about how rails finds the 'log_in' method in create action? Since I did not include log_in action in current user controller and neither in user_helper controller and application_helper controller, rails should not find this action at all. Is there any convention that rails will find action in other places? </p>
  
  <p>1.This is normal my user_controller.rb</p>
  
  <pre><code>class UsersController &lt; ApplicationController
    before_action :set_user, only: [:show, :edit, :update, :destroy]
    before_action :require_login, except:[:new, :create] 
  
    # GET /users
    # GET /users.json
    def index
      @users = User.all
    end
  
    # GET /users/1
    # GET /users/1.json
    def show
      @user = current_user
    end
  
    # GET /users/new
    def new
      @user = User.new
    end
  
    # GET /users/1/edit
    def edit
    end
  
    # POST /users
    # POST /users.json
    def create
      @user = User.new(user_params)
  
      respond_to do |format|
        if @user.save
          log_in(@user)
          puts @user
          puts session[:user_id]
  
          format.html { redirect_to @user, notice: 'User was successfully created.' }
          format.json { render :show, status: :created, location: @user }
        else
          format.html { render :new }
          format.json { render json: @user.errors, status: :unprocessable_entity }
        end
      end
    end
  </code></pre>
  
  <p>2. This is my application_helper.rb</p>
  
  <pre><code>module ApplicationHelper
  end
  </code></pre>
  
  <p>3. This is my users_helper.rb</p>
  
  <pre><code>module UsersHelper
  end
  </code></pre>
  
  <p>4. This is my application_controller.rb</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
      before_action :require_login
          def require_login
              if !logged_in?
                  redirect_to login_path
              end
          end
  end
  </code></pre>