Rails4: replace deprecated find_all_by_* at Journal model
git-svn-id: http://svn.redmine.org/redmine/trunk@12499 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
52bcc01b32
commit
89b5518e0b
@ -148,7 +148,7 @@ class Journal < ActiveRecord::Base
|
|||||||
def self.preload_journals_details_custom_fields(journals)
|
def self.preload_journals_details_custom_fields(journals)
|
||||||
field_ids = journals.map(&:details).flatten.select {|d| d.property == 'cf'}.map(&:prop_key).uniq
|
field_ids = journals.map(&:details).flatten.select {|d| d.property == 'cf'}.map(&:prop_key).uniq
|
||||||
if field_ids.any?
|
if field_ids.any?
|
||||||
fields_by_id = CustomField.find_all_by_id(field_ids).inject({}) {|h, f| h[f.id] = f; h}
|
fields_by_id = CustomField.where(:id => field_ids).all.inject({}) {|h, f| h[f.id] = f; h}
|
||||||
journals.each do |journal|
|
journals.each do |journal|
|
||||||
journal.details.each do |detail|
|
journal.details.each do |detail|
|
||||||
if detail.property == 'cf'
|
if detail.property == 'cf'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user