scope with a proc which return nil should still be chainable

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • 3.1.3
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      just like activerecord, the scope should always be chainable, so we can write

      scope :before_date, ->(date) { where(:date.lt => date) if date}
      

      instead of

      scope :before_date, ->(date) { date ? where(:date.lt => date) : all}
      

              Assignee:
              Durran Jordan
              Reporter:
              dianhui
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: