Reacting to events with JavaScript is the foundation of a dynamic experiences on the web. Whether it's a click event or another typical action, responding
Sometimes want to skip certain validations on your database models. Maybe you have a multi-step wizard or want admins to have more freedom in changing data.
If you ask any developer what is technical debt they will probably tell you something along the lines of: Cutting corners just to make things work. But there's another kind of debt that often goes unnoticed: just-in-case abstractions and features. These appear as a result of rationalizations such as "I might need this later" without a ...
When working with complex forms, it's really easy to immediately start adding JavaScript to implement non-common behaviors. But there are some hidden gems in the HTML standard that allow us to do a lot of that without adding a single line of JavaScript!
So we checked 2 major ways already of creating public (more or less) static pages:
1. brute force drop your HTML into the app/assets/public
2. have custom actions in something like a PublicPagesController/StaticPagesController.
Now I wanted to look at another approach.
Originally, I saw this in David
The "current pattern" or "current context" is a technique that allows you to access some per-request data easily without having to explicitly pass it around everywhere. Recent versions of Rails offer explicit support for it. The current pattern, used judiciously, will help clean up your code and make your life swell!