Hi guys, I'want to introduce this discussion (I'm looking for similar here, but don't found it)
Actually the scopes chainity is glued with "AND" operator.
Some times we need to chain the same scope implemented method using both "OR" or cases with "AND" operators. But It's not possible because chainity does only with "AND" operator. If you need "OR" conditions you need to re-implement explicit method to do it.
In the interests of DRY, what you think to pass a "chainity_operator" param in chain scopes?? by default can be set to "AND", but can be changed for an "OR" if need. Then we can reuse the sames scopes on differents combinations.
Or may a chainity_operator method that can be chained with scoped where methods?
I'm not sure if possible or if it break any AR-AREL architecture.Best
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/LFQWTRHdM8EJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
We have wanted similar, and resorted to getting where's out of arel.I thought about the following syntax:MyModel.somescope.or(something_which_is_a_scope_chain_too)
Sent from my iPhone
Hi guys, I'want to introduce this discussion (I'm looking for similar here, but don't found it)
Actually the scopes chainity is glued with "AND" operator.
Some times we need to chain the same scope implemented method using both "OR" or cases with "AND" operators. But It's not possible because chainity does only with "AND" operator. If you need "OR" conditions you need to re-implement explicit method to do it.
In the interests of DRY, what you think to pass a "chainity_operator" param in chain scopes?? by default can be set to "AND", but can be changed for an "OR" if need. Then we can reuse the sames scopes on differents combinations.
Or may a chainity_operator method that can be chained with scoped where methods?
I'm not sure if possible or if it break any AR-AREL architecture.Best
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/LFQWTRHdM8EJ.
To post to this group, send email to rubyonrails-core@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/vMihSC-FuxgJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
Hi guys, I'want to introduce this discussion (I'm looking for similar here, but don't found it)
Actually the scopes chainity is glued with "AND" operator.
Some times we need to chain the same scope implemented method using both "OR" or cases with "AND" operators. But It's not possible because chainity does only with "AND" operator. If you need "OR" conditions you need to re-implement explicit method to do it.
In the interests of DRY, what you think to pass a "chainity_operator" param in chain scopes?? by default can be set to "AND", but can be changed for an "OR" if need. Then we can reuse the sames scopes on differents combinations.
Or may a chainity_operator method that can be chained with scoped where methods?
I'm not sure if possible or if it break any AR-AREL architecture.Best
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-core/-/Tx8fWmHOCmIJ.