Q:

Where to put method that returns a collection

I have a Shop model.
In my class, I have created several methods, that allow me to make my code easier to read. 
Things like :
# Returns True if the shop has an owner
def is_claimed
  return self.owner_id != nil
end

Now I want to create a method that would return a collection of Shops.
Something like :
def get_all_open
  return Shop.where("shops.closed != 1")
end

I am simply wondering where I should place it, so it is available from anywhere where I can potentially use 
Shop.all

in my code. 

If I place it in the Model, it will be available to instances of shops, which would sound weird. 
This method also belongs to Shop, so I don't really like placing it in the ApplicationController.
I also thought about placing it in the shops_controller, but then it won't be available easily to other controllers. 

I have looked on the internet, but failed to find something I like so far. What would be considered a good practice in rails ? 
Thanks

A:

You can keep it in the Model, but instead of defining it as an instance method, define it as a class method:
def self.all_open
  where("shops.closed != 1")
end

This way you can use it like this:
Shop.all_open

And even nest methods, like this:
Shop.all_open.where(field: "value")

UPDATE:
Like others pointed out, you could also use scopes (this is the preferred way):
class Shop < ActiveRecord::Base
  scope :all_open, -> { where("shops.closed != 1") }
end

The usage would be the same:
Shop.all_open

