Posted 3 months ago. Visible to the public.

Beware: Don't name a controller action "cookies"

The method cookies is defined in the ActionController and should never be overwritten.

Bad example

Copy
class StaticPagesController < ApplicationController def imprint end def cookies redirect_to '/' end end

If you create an action called cookies, any call to the cookie storage will be broken and call the method. What's more, in this example calls to static_pages_controller#imprint might as well end up redirecting to the homepage.

Solution

Just define the action as cookies_action or similar and adjust your route, i.e.:

Copy
get :cookies, to: 'footer_pages#cookies_action'

Once an application no longer requires constant development, it needs periodic maintenance for stable and secure operation. makandra offers monthly maintenance contracts that let you focus on your business while we make sure the lights stay on.

Owner of this card:

Avatar
Michael Leimstädtner
Last edit:
3 months ago
by Michael Leimstädtner
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Michael Leimstädtner to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more