run method before rails code example Example: run method before rails before_action :run_method, only: [index, :show]