Rails ERD diagram visualisation online
Public

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Ă 

https://dbdiagram.io/d

Brakeman - An awesome gem that scans your app against vulnerabilities.
Public

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...

https://github.com/presidentbeef/brakeman

Rails migration decimal precision scale
Public

Rails migration decimal precision scale explained quasi visually ``` 123.45678912345 <- scale -> <- precision -> ```

How to drop a production database in Rails 5
Public

I encountered a problem when dropping a production database. Here's the solution

How to use helper methods in mailer templates
Public

How to use helper methods in mailer templates? Instead of this "include YourHelper" use this "add_template_helper YourHelper" in YourMailer

How to deal with RSpec time precision error
Public

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.

How to detect time-overlapping-records in Postgres + Rails
Public

```ruby Model .where("TSRANGE(?, ?, '()') && TSRANGE(starts_at, ends_at, '()')", starts_at, ends_at) .where.not(id: record_id) .exists? ``` Bot...

When to use let, let! and before in RSpec
Public

When to use let, let! and before in RSpec.

Make RSpec shared examples easier to understand with this one trick!
Public

This guy makes his shared examples easier to understand. Overpaid consultants hate him!

Define routes for external links in rails
Public

You can define external urls in routes.rb instead of creating helpers manually

https://guides.rubyonrails.org/routing.html#direct-routes

Compiling ES6 syntax with Uglifier on
Public

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...

Example tmux script for Rails
Public

Shell script that will start a tmux session with Rails console and server in side panes