How to find all region names for a given class in Ruby on Rails?

For example, if you specify specific areas for the Task class, is there a way to find all the area names for this class?

I am looking for something like:

Task.scope_names

which outputs something like:

["completed", "uncompleted", "pending"]

Any ideas on how to do this?

+4
source share
1 answer

According to docsmethods such as

Model.scopes 
#=> outputs all scopes

and

Model.send(:valid_scope_name?, scope_name)
#=> takes scope name as an argument and returns either true or false

no longer available with Rails 3.1.0.

+8
source

All Articles