Skip to content

Commit

Permalink
Restore rails5 support (#919)
Browse files Browse the repository at this point in the history
* rails 5 does not have pick, fixes latest status check
  • Loading branch information
orangewolf authored Feb 9, 2024
1 parent 3571792 commit ab7a6ba
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/models/bulkrax/status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ def self.latest_by_statusable_subtable
end

def latest?
self.id == self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pick(:id)
# TODO: remove if statment when we stop supporting Hyrax < 4
self.id == if Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new('6.0.0')
self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pick(:id)
else
self.class.where(statusable_id: self.statusable_id, statusable_type: self.statusable_type).order('id desc').pluck(:id).first # rubocop:disable Rails/Pick
end
end
end
end

0 comments on commit ab7a6ba

Please sign in to comment.