...intensive for large files Other ways to solve this problem Other solutions might work better and make more sense depending on what you are trying to achieve. These alternatives could...
...you obviously do not want to duplicate it and your tests might very well benefit from this approach. Use it with care, however -- doing this more than a few times...
...making the test impossible to read). An alternative is also to hide that functionality behind other steps that do more complex things differently...
To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...
By default subscript ( ) and superscript ( ) tags are styled with vertical-align: sub, respectively vertical-align: super by most browsers.
Knowing when to refactor Just feeling like refactoring is not a good reason to do it. Make an educated decision...
This cards describes an example with a Github Client on how to keep your Rails application more maintainable by extracting...
When you query the browser for DOM elements, there are some footguns you should know about. Some lists are synchronized...
When you use Sentry to monitor exceptions, an important feature is Sentry's error grouping mechanism. It will aggregate similar...
When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc.
This card will show you how to use git rebase --onto without confusion. Use case: You've got two feature...
Spammers have started abusing other application to send their spam. This works like this: The application has some form that...
Fill in find field with e.g. url (? .*?) Hint: the "url" at the beginning of the string is just a text fragment; the (? .*?) is our named capture group.
...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.
vertical-align is hard. Have you ever wanted to vertically center an icon with text? This usually means "vertically align...
To apply transparency to an element, you can use opacity in CSS. However, sometimes you don't want to make...
...to e.g. lock an entire form while it is being changed. This requires code beyond database locking, in both backend and frontend...
...index: true option. Use it only inside create_table or for add_reference (= add_belongs_to) statements, and use add_index for other cases. Never use index: true but only...
...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
...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...
This is painful. Consider using Microsoft Office or switching careers. If you need to write < 20 letters consider doing it...
...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...
TL;DR There are three dimensions you can control when scoping routes: path helpers, URL segments, and controller/view module.
...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...