Notes posted by jmarceli
RSS feed
0 thanks
Counting with select
If you try to write
Model.select('field_one', 'field_two AS something').count
it will fail (at least for Rails 5.0) with the message PG::SyntaxError: ERROR: syntax error at or near “AS”. In order to fix that issue, you should write
Model.select('field_one', 'field_two AS something').count(:all)

0 thanks
Default values
By default :on_update and :on_delete have :restrict value.