Closed asanger closed 9 years ago
A symmetric API totally makes sense for me. Thanks for your contribution!
@geekq on this same line of thought, how do you feel about scopes using the can_<event_name>
syntax?
For example, if I wanted all articles that can be published, I could do Article.can_publish
, which would be a scope of .where(:state_column_name => ['draft', 'hold'])
, with the array containing all the statuses that are allowed to transition into that new state.
Just want to get your feedback real quick before I spend the time to add it.
Thanks for the ideas! That API could be helpful in some scenarios.
However I would like to avoid integrating all the APIs, that just possibly useful. Trying to limit to some sort of core API, which is needed by most/many people.
You can extract your implementation as
Perfect - thanks for the response.
Sometimes it's nice to just fetch everything that's not in a certain state. This will allow me to clear quite a few self-defined scopes in my projects.