1. 02 8月, 2013 6 次提交
  2. 01 8月, 2013 9 次提交
  3. 31 7月, 2013 1 次提交
  4. 30 7月, 2013 2 次提交
  5. 29 7月, 2013 2 次提交
    • S
      Add ability to specify how a class is converted to Arel predicate · 92a60338
      sgrif 提交于
      This adds the ability for rails apps or gems to have granular control
      over how a domain object is converted to sql. One simple use case would
      be to add support for Regexp. Another simple case would be something
      like the following:
      
          class DateRange < Struct.new(:start, :end)
            def include?(date)
              (start..end).cover?(date)
            end
          end
      
          class DateRangePredicate
            def call(attribute, range)
              attribute.in(range.start..range.end)
            end
          end
      
          ActiveRecord::PredicateBuilder.register_handler(DateRange,
            DateRangePredicate.new)
      
      More complex cases might include taking a currency object and converting
      it from EUR to USD before performing the query.
      
      By moving the existing handlers to this format, we were also able to
      nicely refactor a rather nasty method in PredicateBuilder.
      92a60338
    • A
  6. 26 7月, 2013 1 次提交
  7. 25 7月, 2013 1 次提交
  8. 24 7月, 2013 10 次提交
  9. 23 7月, 2013 8 次提交