Behold, a before_filter:
before_filter
class ThingController < ApplicationController before_filter :check_stuff, :if => proc {Rails.env.production?} end <
I would recommend using staby lambda. If you want know, WHY? Please read this
class ThingController < ApplicationController before_action :check_stuff, if: -> { Rails.env.production? } end
which is almost equivalent to Upvote Me's answer.