Rails' params hash contains any request parameters (URL parameters or request payload) as well as routing parameters like :controller, :action...

makandra dev

This is a presentation from 2019-01-21. Summary We want to move away from jQuery in future projects

When restoring a PostgreSQL dump using pg_restore, you usually add the --clean flag to remove any existing data from...

tableplus.io

To remove all tables from a database (but keep the database itself), you have two options. Option 1: Drop the...

When building an application that sends e-mails to users, you want to avoid those e-mails from being classified...

If your app does not need to support IE11, you can use most ES6 features without a build step. Just...

makandra dev

Suggested Workflow Set the ruby version in .ruby-version to 2.3.5, then perform these steps one by one, fixing errors...

Remember How to skip Sprockets asset compile during Capistrano deployment and Automatically skipping asset compilation when assets have not changed...

stackoverflow.com

To reload a single-item association in Rails 5+, call #reload_ : post.reload_author In older Railses you can say

When upgrading Rails versions -- especially major versions -- you will run into a lot of unique issues, depending on the exact...

The Ace editor is a great enhancement when you want users to supply some kind of code (HTML, JavaScript, Ruby...

When projects run for many years, they require special regular maintenance to stay fresh. This kind of maintenance is usually...

It is very common to parse dates from strings. It seems obvious to use Date.parse for this job. However this...

It is possible to access Rails config (for example secrets) from within your webpack bundles, thanks to rails-erb-loader...

In this example we assume that not only the storage gem changes but also the file structure on disc.

island94.org

Rails 5.2 soft-deprecated the storage of secrets in secrets.yml in favor of a new thing, credentials.yml.enc. Rails 7.1 deprecated...

If you use transactional_fixtures or the database_cleaner gem with strategy :transaction, after_commit callbacks will not be fired...

If validations failed for a record, and you want to find out if a specific validation failed, you can leverage...

Let's say you have a gem which has the following module: module SuperClient def self.foo 'Foo' end

Migrating data from a legacy into a new system can be a surprisingly large undertaking. We have done this a...

At makandra, we've built a few gems over the years. Some of these are quite popular: spreewald (> 1M downloads...

Why secure-only cookies used to be necessary Cookies have an optional secure flag. It tells the browser to not...

Background information about session storage in Rails Rails has a default mechanism to store the session in the CookieStore. This...

Rails defines a #truncate helper as well as a method String#truncate. = truncate("my string", length: 5) = "my string".truncate...