82

Вопрос по ruby-on-rails – Rails фильтрует массив объектов по значению атрибута

Error: User Rate Limit Exceeded @attachments = Job.find(1).attachmentsError: User Rate Limit ExceededAttachmentError: User Rate Limit Exceededfile_typeError: User Rate Limit ExceededattachmentsError: User Rate Limit Exceeded'logo'Error: User ...

4 ответа

155

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

@logos = @attachments.select { |attachment| attachment.file_type == 'logo' }
@images = @attachments.select { |attachment| attachment.file_type == 'image' }

Error: User Rate Limit Exceeded

@logos , @images = [], []
@attachments.each do |attachment|
  @logos << attachment if attachment.file_type == 'logo'
  @images << attachment if attachment.file_type == 'image'
end
0

Error: User Rate Limit Exceeded

Job.includes(:attachments).where(file_type: ["logo", "image"])
2

Error: User Rate Limit Exceeded

@attachments = Job.includes(:attachments).find(1).attachments
7

Error: User Rate Limit Exceeded

@attachments = Job.find(1).attachments

Error: User Rate Limit Exceeded

Error: User Rate Limit Exceeded

@logos = @attachments.select { |attachment| attachment.file_type == 'logo' }
@images = @attachments.select { |attachment| attachment.file_type == 'image' }

Error: User Rate Limit Exceeded

Похожие вопросы