This would be a very good idea; I proposed this change on GitHub a few months ago, but it didn't get a lot of traction: https://github.com/rails/rails/issues/5545.
I think chaining scopes with OR would be a very common use case for a search functionality. For example, you could allow users to search for something matching all parameters (chaining with AND) or only one of them (chaining with OR). I think it would be a relatively simple change to implement, but I'm not at all familiar with Rails' source code, so I don't really know what I'm talking about here. Anyway, consider this +1 from me. Emile Le 2012-06-21 à 09:48, daniel2d2art a écrit : > 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. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
