From 18d8929bf159821d2231a4833c443b3eb8c571d7 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sun, 25 Sep 2016 23:35:26 +0800 Subject: [PATCH] use .or to fix all sorts of @map.mappings bugs --- app/models/map.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/models/map.rb b/app/models/map.rb index 0cab398d..f9fe6312 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -16,11 +16,12 @@ class Map < ApplicationRecord has_many :events, -> { includes :user }, as: :eventable, dependent: :destroy # This method associates the attribute ":image" with a file attachment - has_attached_file :screenshot, styles: { - thumb: ['188x126#', :png] - #:full => ['940x630#', :png] - }, - default_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map-white.png' + has_attached_file :screenshot, + styles: { + thumb: ['188x126#', :png] + #:full => ['940x630#', :png] + }, + default_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map-white.png' validates :name, presence: true validates :arranged, inclusion: { in: [true, false] } @@ -31,7 +32,7 @@ class Map < ApplicationRecord validates_attachment_content_type :screenshot, content_type: /\Aimage\/.*\Z/ def mappings - topicmappings + synapsemappings + topicmappings.or(synapsemappings) end def mk_permission