...in development + test, but keep action_on_unpermitted_parameters = false in production, your application behaves different between these environments. On the other hand it forces to fix these errors in...

...Parameters).to receive(:action_on_unpermitted_parameters).and_return(false) for tests, that should behave exactly like in production...

github.com

...API design, I thought it might be nice to write down a set of best practices. And poke fun at a couple widely-used APIs. Much of this may be...

...all routes, but may return early, a change has been introduced to add lazy behavior by adding an iterator block and yielding. This change breaks the adapter patch in routing...

} Enumerable#index_with (Rails 6+) To generate a hash where array elements become hash keys, and values are calculated from them, use index_with. users = User.all

The attached compiler() function below applies JavaScript behavior to matching HTML elements as they enter the DOM. This works like an Unpoly compiler for apps that don't use Unpoly...

caniuse.com

All major browsers (IE8+, FF3.5+, Safari 4+, any Chrome) support sessionStorage, a JavaScript storage object that survives page reloads and...

...you will sign out your current user whenever you switch to another app. A better way is to use our own daho.im service. All daho.im subdomains resolve to your local...

makandra dev

Timecop is a great gem to set the current time in tests. However, it is easy to introduce flakyness to...

Rails 7.1 added the normalizes method which can be used to normalize user input. It lets you define the fields...

docs.gitlab.com

Use rules to include or exclude jobs in pipelines. Rules are evaluated in order until the first match. When a...

en.wikipedia.org

Although you can access many symbols using the AltGr key you may be missing some, like the en-dash (–) or...

You can run bundle install in parallel. This might be helpful for development, where you often install many new gems...

No out of the box I18n support for translating the database values But: Better support for the enumerated database type and therefore better suited for performance optimizations

developer.mozilla.org

...methods usually don't print background colors. In most cases this is the desired behavior, because you don't want to spend tons of ink printing the background of a...

Development environment setup Rails Composer Basically a comprehensive Rails Template. Prepares your development environment and lets you select web server...

Attaching files to a field that is handled by Carrierwave uploaders (or maybe any other attachment solution for Rails) in...

...file_inside' do let(:path) { '/opt/invoices/' } it 'should send a requested file that lives beneath the given directory' do subject.should_receive(:send_file).with('/opt/invoices/123.pdf', {}) subject.send :send_file_inside, path...

If you have content inside a page that is hidden by CSS, the following will work with Selenium, but not...

Tested on Ubunut 22.04 1. Opener script Create a file ~/.local/bin/coverage_zip_opener with: #!/bin/bash tmp_folder="/tmp/coverage-report-opener" if [ -z "$1" ]

makandra dev

We structure our CSS using the BEM pattern. Our naming convention for blocks, elements and modifiers has evolved over the years. This card shows our current style and various alternative...

...not mix styles and be consistent within a given project. Current convention Our current BEM naming convention looks like this:

Note how the modifier just starts with a dash (-pro...

Rails' default logger prefixes each log entry with timestamp and tags (like request ID). For multi-line entries, only the...

github.com

Let the following setup: # my_model_spec.rb describe MyModel do it 'perfoms a test' it_behaves_like 'something shared' end # something_shared.rb shared_examples_for 'something shared' do it 'does something'

...a test' is spec/models/my_model_spec.rb[1:1]. The ID of the ExampleGroup created by it_behaves_like 'something shared' is spec/models/my_model_spec.rb[1:2] as it is the second ExampleGroup in the...

=> #<Capybara::Node::Element tag="div" path=... If you rely on this behavior in Capybara 3, affected features will fail. The gem no longer normalizes whitespace when finding...

...visible css ".haystack" with text "Hi! Try to match me." Re-enabling Cabyara 2 behavior in Capybara 3 After digging in the documentation, you might figure out that you can...

Is your application doing something expensive every few seconds? Maybe an animated slider that rotates images? Maybe you are updating...