From 532248593149616c8d8a6eb73ae129ef4c0f0ffb Mon Sep 17 00:00:00 2001 From: Ryan Baumann Date: Tue, 26 Jan 2021 11:47:12 -0500 Subject: [PATCH] Remove deprecates #scope with hash (see #271) --- app/models/board.rb | 6 ++---- app/models/comment.rb | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/app/models/board.rb b/app/models/board.rb index 6655ad44e..0526f34bc 100644 --- a/app/models/board.rb +++ b/app/models/board.rb @@ -19,11 +19,9 @@ class Board < ActiveRecord::Base #board rank determines workflow order for publication #ranked scopes returns the boards for a given community in order of their rank #ranked left as default for sosol ranks - scope :ranked, :order => 'rank ASC', :conditions => { 'community_id' => nil } + scope :ranked, -> { where(community_id: nil).order(rank: :asc) } - scope :ranked_by_community_id, lambda { |id_in| { :order => 'rank ASC', :conditions => [ 'community_id = ?', id_in ] } } - - + scope :ranked_by_community_id, lambda { |id_in| { where(community_id: id_in).order(rank: :asc) } } # :identifier_classes is an array of identifier classes this board has # commit control over. This isn't done relationally because it's not a diff --git a/app/models/comment.rb b/app/models/comment.rb index 2cf5ca02a..4c17fed89 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -12,11 +12,11 @@ class Comment < ActiveRecord::Base belongs_to :identifier #create named scope for each type of reason - scope :commit, :conditions => { :reason => 'commit' } - scope :finalizing, :conditions => { :reason => 'finalizing' } - scope :submit, :conditions => { :reason => 'submit' } - scope :general, :conditions => { :reason => 'general' } - scope :vote, :conditions => { :reason => 'vote' } + scope :commit, -> ( where(reason: 'commit') } + scope :finalizing, -> ( where(reason: 'finalizing') } + scope :submit, -> ( where(reason: 'submit') } + scope :general, -> ( where(reason: 'general') } + scope :vote, -> ( where(reason: 'vote') } def comment=(comment_text) write_attribute(:comment, CGI.escape(comment_text))