The way Rational#to_s works on Ruby has changed from Ruby 1.9 on. Here is how to get the...

To attach files to your records, you will need a new database column representing the filename of the file...

It's 2024 and we have tools like ffmpeg, imagemagick and GPT readily available. With them, it's easy to...

Do not pass times to date attributes. Always convert times to dates when your application uses time zones. Background

makandra dev

def store_new_password # ... end end Write classes for parameters that belong together Sometimes you see multiple functions that always use the same parameters. This often happens if...

Sometimes you'll find yourself with a set of tasks that require similar code for different models. For example, if...

When your model is using a callback like before_save or before_validation to calculate an aggregated value from its...

Download buttons can be difficult to test, especially with Selenium. Depending on browser, user settings and response headers, one of...

CarrierWave comes with a set of default configuration options which make sense in most cases. However, you should review these...

Looking at the source code of the validates_numericality_of validator, it becomes clear that it converts the attribute in...

In order to have monitoring for Sidekiq (like queue sizes, last run of Sidekiq) your application should have a monitoring...

Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...

weblog.jamisbuck.org

How to get a backtrace from a running Ruby process: Ruby 2.6 # First, find out the PID of your Ruby...

get_route_with_tokens first_etag = get_etag get_route_with_tokens second_etag = get_etag expect(second_etag).to eq(first_etag) end it 'sends different...

...get a different ETag for a different user session reset_session get_route_with_tokens second_etag = get_etag expect(second_etag).to_not eq(first_etag) end end

Every modern Rails app should have a Content Security Policy enabled. Very compatible default The following "default" is a minimal...

Nokogiri is great. It will even fix invalid HTML for you, like a browser would (e.g. move block elements out...

When storing files for lots of records in the server's file system, Carrierwave's default store_dir approach may...

When putting phone numbers into web pages, you should use tel: links so smartphone users can click those numbers to...

If you want to prevent that two processes run some code at the same time you can use the gem...

If you need to make an HTTPS connection to a host which uses an expired certificate, do not disable certificate...

stackoverflow.com

When you use method_missing to have an object return something on a method call, always make sure you also...

GoodJob and ActiveJob rescue exceptions internally, preventing exception_notification from triggering. This can cause silent job failures.To get notified, subscribe...

When making requests using the http gem you might want to automatically follow redirects to get the desired response. This...

Sometimes you need to remove high Unicode characters from a string, so all characters have a code point between 0...