We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44e8ea3 commit 998c202Copy full SHA for 998c202
app/models/protip.rb
@@ -782,7 +782,13 @@ def images
782
if self.new_record?
783
self.links.select { |link| ProtipLink.is_image? link }
784
else
785
- protip_links.loaded? ? protip_links.select { |p| ProtipLink::IMAGE_KINDS.include?(p.kind.to_sym) }.map(&:url) : protip_links.where('kind in (?)', ProtipLink::IMAGE_KINDS).map(&:url)
+ if protip_links.loaded?
786
+ protip_links.select do |p|
787
+ ProtipLink::IMAGE_KINDS.include?(p.kind.to_sym) if p.kind
788
+ end.map(&:url).compact
789
+ else
790
+ protip_links.where('kind in (?)', ProtipLink::IMAGE_KINDS).map(&:url)
791
+ end
792
end
793
794
0 commit comments