Module: Biscuit::BiscuitHelper

Defined in:
app/helpers/biscuit/biscuit_helper.rb

Instance Method Summary collapse

Instance Method Details

#biscuit_allowed?(category) ⇒ Boolean

Returns true if the user has consented to the given category. Safe to call even when no cookie exists — returns false.

Returns:

  • (Boolean)


14
15
16
# File 'app/helpers/biscuit/biscuit_helper.rb', line 14

def biscuit_allowed?(category)
  Biscuit::Consent.new(cookies).allowed?(category)
end

#biscuit_banner(**options) ⇒ Object

Renders the consent banner. If consent has already been given, renders only the minimal “Cookie settings” reopener link (hidden banner state).



6
7
8
9
10
# File 'app/helpers/biscuit/biscuit_helper.rb', line 6

def biscuit_banner(**options)
  consent = Biscuit::Consent.new(cookies)
  render partial: "biscuit/banner/banner",
         locals: { consent: consent, options: options }
end