Commit b6628b4a97f64bea9a9eec00cba5222e71efc584

Authored by Valeriy Sizov
2 parents 5add5f76 2335d7b9

Merge pull request #1797 from sholden/patch-2

Fix broken Note scopes with lambdas, 4.0 compat
Showing 1 changed file with 6 additions and 6 deletions   Show diff stats
app/models/note.rb
... ... @@ -23,13 +23,13 @@ class Note < ActiveRecord::Base
23 23 mount_uploader :attachment, AttachmentUploader
24 24  
25 25 # Scopes
26   - scope :common, where(noteable_id: nil)
27   - scope :today, where("created_at >= :date", date: Date.today)
28   - scope :last_week, where("created_at >= :date", date: (Date.today - 7.days))
  26 + scope :common, ->{ where(noteable_id: nil) }
  27 + scope :today, ->{ where("created_at >= :date", date: Date.today) }
  28 + scope :last_week, ->{ where("created_at >= :date", date: (Date.today - 7.days)) }
29 29 scope :since, ->(day) { where("created_at >= :date", date: (day)) }
30   - scope :fresh, order("created_at ASC, id ASC")
31   - scope :inc_author_project, includes(:project, :author)
32   - scope :inc_author, includes(:author)
  30 + scope :fresh, ->{ order("created_at ASC, id ASC") }
  31 + scope :inc_author_project, ->{ includes(:project, :author) }
  32 + scope :inc_author, ->{ includes(:author) }
33 33  
34 34 def self.create_status_change_note(noteable, author, status)
35 35 create({
... ...