TL;DR PostgreSQL handles Rails 4+ text and string columns the same. Some libraries may still reflect on the column...
This cards describes an example with a Github Client on how to keep your Rails application more maintainable by extracting...
The parallel-gem is quite easy to use and can speed up rendering time if you want to render the...
When you want to group rails models of a logical context, namespaces are your friend. However, if you have a...
Knowing when to refactor Just feeling like refactoring is not a good reason to do it. Make an educated decision...
When you use Sentry to monitor exceptions, an important feature is Sentry's error grouping mechanism. It will aggregate similar...
By default subscript ( ) and superscript ( ) tags are styled with vertical-align: sub, respectively vertical-align: super by most browsers.
When HTTP clients make an request they can define which response formats they can process. They do it by adding...
...change the rendered html, some variation of @message.content.body.to_rendered_html_with_layout Changing the behavior of the editor You may want to add some functionality to the editor or remove...
...addEventListener("trix-action-invoke", event => { const { editor } = event.target if (event.actionName === "x-horizontal-rule") { // ... } // Add behavior for the other buttons // ... }) Check the Trix README to check what you can do.
Spammers have started abusing other application to send their spam. This works like this: The application has some form that...
There is no one-liner in Ruby or ActiveSupport with the behavior described above. There have been discussions about adding a method like Enumerable#find_map:
Let's say you have a gem which has the following module: # within the imaginary super gem module SuperClient
...t have control of. Solutions Don't log SQL queries. This is the default behavior of rails but can be changed in the config/environment/production.rb file: config.log_level should not be...
...not scale the icon with the font size. One option that seems to work better is to use the mask CSS feature. The idea is to have an element with...
...var(--icon-url) center / contain no-repeat // this can probably be done in a better way: vertical-align: text-bottom margin-bottom: -.1em // depends on the icons @each $icon in...
...John Doe <user@example.com> Date: Thu Dec 23 13:37:00 2010 +0100 make everything better Once you are done bisecting you can go back with git bisect reset
...would allow to detect the end of windows size changing process. Capybara provides a better way to manipulate the browser window which you should use instead: page.current_window.resize_to. Good: Capybara...
...as isolated (more unit like) tests, one might want to test some cookie dependent behavior as a request, helper or model spec too. Since the rspec documentation on testing cookies...
...that into a class to DRY up your code and write solid unit tests. Beware that your class will not be able to read the cookies, since they are only...
class Post < ActiveRecord::Base has_one :attachment end # attachment.rb class Attachment < ActiveRecord::Base belongs_to :post validates :title, presence: true end Issue When creating a post with an invalid...
...find(..., visible: true) or find(..., visible: :visible). Note that you could change the default behavior by setting the ignore_hidden_elements config option. However, ignoring invisible elements is a useful...
Modern CSS offers the field-sizing property to allow elements to automatically adjust size (width and/or height) to fit their...
While both the alt attribute and the figcaption element provide a way to describe images, the way we write for...
So you're hunting down a regression (or just a bug) and want to use git bisect to find out...
...changes you make to the database will be rolled back on exit. Warning Changes beyond the database (deleting files, sending emails, etc) cannot be rolled back...
...using a multiple assignment for a Regex are named groups. Especially when your Regex becomes more complicates it is easier to understand and to process. Note: In case a string...