Module: Threepwood::ControllerExtensions::InstanceMethods

Defined in:
lib/threepwood/railtie.rb

Instance Method Summary collapse

Instance Method Details

#accept_cookiesObject



18
19
20
21
# File 'lib/threepwood/railtie.rb', line 18

def accept_cookies
  cookies.permanent[:threepwood_accepted] = true
  headers.delete "no-threepwood" #need this if the cookies have been accepeted after the header has been set
end

#check_cookiesObject



10
11
12
13
14
15
16
17
# File 'lib/threepwood/railtie.rb', line 10

def check_cookies
  if cookies[:threepwood_accepted]
    @accepted_cookies = true 
  else
    @accepted_cookies = false
    headers["no-threepwood"] = "true" 
  end
end

#reject_cookiesObject



22
23
24
25
26
27
# File 'lib/threepwood/railtie.rb', line 22

def reject_cookies
  cookies.delete :threepwood_accepted 
  cookies.to_hash.each_pair do |k, v| 
    cookies.delete k.to_sym
  end 
end