Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # for eql and like operators the new value overwrites when merged
- Article.with_scope :author => 'smoot' do
- Article.with_scope :author => 'dkubb' do
- # conditions are:
- # [ :eql, Property<Article, :author>, 'dkubb' ]
- end
- end
- Article.with_scope :author.like => /\Asmoot\z/ do
- Article.with_scope :author.like => /\Adkubb\z/ do
- # conditions are:
- # [ :like, Property<Article, :author>, /\Adkubb\z/ ]
- end
- end
- # for gt and gte operators the smallest value is used when merged
- Item.with_scope :amount.gt => 2.00 do
- Item.with_scope :amount.gt => 1.00 do
- # conditions are:
- # [ :gt, Property<Item, :amount>, 1.00 ]
- end
- end
- Item.with_scope :amount.gt => 1.00 do
- Item.with_scope :amount.gt => 2.00 do
- # conditions are:
- # [ :gt, Property<Item, :amount>, 1.00 ] <-- still 1.00
- end
- end
- # for lt and lte operators the largest value is used when merged
- Item.with_scope :amount.lt => 1.00 do
- Item.with_scope :amount.lt => 2.00 do
- # conditions are:
- # [ :lt, Property<Item, :amount>, 2.00 ]
- end
- end
- Item.with_scope :amount.lt => 2.00 do
- Item.with_scope :amount.lt => 1.00 do
- # conditions are:
- # [ :lt, Property<Item, :amount>, 2.00 ] <-- still 2.00
- end
- end
- # for not and in operators the values are unioned when merged
- Article.with_scope :author.not => 'billg' do
- Article.with_scope :author.not => 'darylm' do
- # conditions are:
- # [ :not, Property<Article, :author>, [ 'billg', 'darylm' ] ]
- end
- end
- Article.with_scope :author.in => 'ssmoot' do
- Article.with_scope :author.in => 'dkubb' do
- # conditions are:
- # [ :in, Property<Article, :author>, [ 'smoot', 'dkubb' ] ]
- end
- end
Add Comment
Please, Sign In to add comment