Module: Otori::Rails::ControllerMacros
- Defined in:
- lib/otori/rails.rb
Instance Method Summary collapse
Instance Method Details
#honeypot(name, wait: nil, only: nil, except: nil, &on_caught) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/otori/rails.rb', line 8 def honeypot(name, wait: nil, only: nil, except: nil, &on_caught) = {} [:only] = only if only [:except] = except if except before_action(**) do next unless Otori.caught?( name, params:, session:, wait: ) if on_caught instance_exec(&on_caught) else head :no_content end end end |