How to Use Scopes in Ruby on Rails
What is a scope in Rails & why is it useful? Well… Scopes are custom queries that you define inside your Rails models with the scope method. Every scope takes two arguments: It looks like this: As a result of calling a scope, you’ll get an ActiveRecord::Relation object. Which means you can chain & combine … Read more