Method: ActiveSupport::Callbacks::Filters::Before#call

Defined in:
activesupport/lib/active_support/callbacks.rb

#call(env) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'activesupport/lib/active_support/callbacks.rb', line 172

def call(env)
  target = env.target
  value  = env.value
  halted = env.halted

  if !halted && user_conditions.all? { |c| c.call(target, value) }
    result_lambda = -> { user_callback.call target, value }
    env.halted = halted_lambda.call(target, result_lambda)
    if env.halted
      target.send :halted_callback_hook, filter, name
    end
  end

  env
end