Do not pass times to date attributes. Always convert times to dates when your application uses time zones. Background
Basic validations Read the Rails Guide on ActiveRecord Validations. You should have an overview which kinds of validations are built...
...notification service: Use @Input() id: number with component input binding; Update notification.service.ts: Define notification$: BehaviorSubject: Store the last fetched notification; Update notification$ when a new notification is fetched; Using Efficient...
...keywords in your prompts. LLMs excel at pattern recognition, and specific terminology reduces ambiguity. Beyond that giving examples for high level APIs of your imagened class design or using an...
...only a millisecond or two: class FatModelMaterializedJson < ApplicationRecord def self.refresh ActiveRecord::Base.connection.execute(<<~SQL) DO $$ BEGIN IF ( (SELECT last_refreshed_at FROM aggregated_names LIMIT 1) < (SELECT MAX(updated_at) FROM...
Getting an entire test suite green can be a tedious task which involves frequent switches between the CLI that is...
This note shows how to merge an ugly feature branch with multiple dirty WIP commits back into the master as...
...helper in many views, but in the index view I hide the label to better fit the layout. Here is the helper: module IconHelper def icon(*args, &block) options = args.extract...
end end def allowed_mime_types %w(image/jpeg image/png) end end This will behave like the solution before: User#portrait will get an expected error message and the User...
...Tue, 09 Oct 2018 In most of the cases it would be better to use Date.strptime as you can provide a date or time pattern to match against. Date.strptime('Foobar...
...there" or "fill that space" (they're not suited for photographs and the like). Benefits are the MUCH smaller file size and the crisp and sharp rendering at any scale...
...actually all browsers pretend to support SVG, some barely complex use cases get you beyond common browser support. In the basic scenario, you use SVGs instead of PNG or JPG...
...Rails code is doing the delivery you can do your usual authentication and authorization beforehand. There are few exceptions where you want to store confidential files in the public folder...
Background information about session storage in Rails Rails has a default mechanism to store the session in the CookieStore. This...
Ruby (business logic) HTML fragments (layouts and views) CSS/Sass/SCSS (styles) JavaScript (client-side behavior) Static media (images, fonts, videos) Except for the Ruby part, all these files are shipped...
...frees you from needing Webpack and Yarn. This is an experimental solution that could become the default in future Rails versions. It lacks any transpilation/transformation and bundling features. They reason...
You can use mail-tester.com to check your application's e-mails for issues that might cause e-mails to be...
...styles from the document. See Styling a Web Component for this case. Applying JavaScript behavior to new elements All client-side JavaScript frameworks comes with mechanisms to activate JavaScript behavior...
...a framework mechanism you may use customElements.define() to register your custom element's JavaScript behavior with the browser directly. A big advantage of using the browser's customElements.define() is that...
It is just not worth the risk and you can always do better. Alternatives Instead, you should take a different approach. Here are several alternatives.
Note The maintenance mode is enabled on all application server as soon as the file /public/system/maintenance.html is present. Installation
It's not a good idea to leave data objects mutable. They should behave like integers. Ruby's Data would have already enforced that. Because I used a regular...
...attr}=" do |value| if @readonly raise 'Readonly' else super(value) end end end Weird behavior changes from composed_of The method composed_of accepts the option :mapping, which is required...
A general overview about why and how we migrate can be found under Migrating from Elasticsearch to Opensearch
...or use a more mature solution like Webpack. Modules shared between entry points always become chunks When two entry points import the same module, that module automatically a separate file...
...a way to set a minimum file size for chunking, or to control chunking behavior per import. However there is currently no configuration at all. Modules imported by multiple entry...
...and perform the following exercises. Tip If you've forked your MovieDB in the beginning, Jasmine is already integrated in your code base. Movie counter In Working with the DOM...
...I am really pleased with it -- but only on a desktop computer. Have you benchmarked the framework also on smartphones and tablets? Unfortunately I must say, that it does not...
...as a jQuery collection: let $element = $(element) An API object to call additional JavaScript behavior added by a library: var player = flowplayer($element) player.play() Framework activation layers (like Angular directives...
When your code does not behave as expected, you can use a debugger statement ("breakpoint") at any point in your code. This statement will open a REPL ("console") that you...
...the exact line in the code where your expectation does not match the actual behavior. Since we use open source for everything, we can always find that line. When you...
...Yourself (or DRY). In Ruby on Rails we keep our code DRY by sharing behavior by using inheritance, modules, traits or partials. When you reuse behavior you want to reuse...
...module that you include in the Cucumber world. This way the module's methods become available to all step definitions. Think of it as enhancing your Capybara API with app...