```ruby Model .where("TSRANGE(?, ?, '()') && TSRANGE(starts_at, ends_at, '()')", starts_at, ends_at) .where.not(id: record_id) .exists? ``` Bot...
Manual: 1. Go to https://dbdiagram.io/d 2. Click *import* and choose *Import from Rails (schema.rb)* 3. Paste schema.rb content 4. voilĂ
In some cases, Ruby uses higher precision to represent time than the DB. When we compare a timestamp before and after saving to the DB it might not be equal.
https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale
Rails migration decimal precision scale explained quasi visually ``` 123.45678912345 <- scale -> <- precision -> ```
How to use helper methods in mailer templates? Instead of this "include YourHelper" use this "add_template_helper YourHelper" in YourMailer
Shell script that will start a tmux session with Rails console and server in side panes
When you try to compile ES6 syntax with Uglifier gem initialized you get this error: ``` Uglifier::Error: (...) To use ES6 syntax, harmony mode must be e...
To use Brakeman, the only thing is to install the gem: ``` $ gem install brakeman ``` and then run the single command in Rails application's root dir...
You can define external urls in routes.rb instead of creating helpers manually
I encountered a problem when dropping a production database. Here's the solution
This guy makes his shared examples easier to understand. Overpaid consultants hate him!
When to use let, let! and before in RSpec.