Permalink
Browse files

Fix image upload and add note.

  • Loading branch information...
1 parent 14d183f commit 88a947532c75cddb2f1df8295f7bfca25dfebfa8 @gmanley committed Jul 22, 2012
Showing with 5 additions and 2 deletions.
  1. +0 −2 app/models/album.rb
  2. +5 −0 app/models/container.rb
View
@@ -5,8 +5,6 @@ class Album < Container
field :image_count, type: Integer, default: 0
index :image_count
- scope :with_images, excludes(image_count: 0)
-
def set_thumbnail_url
unless images.empty?
update_attribute(:thumbnail_url, images.sample.image_url(:thumb))
View
@@ -24,6 +24,11 @@ class Container
scope :albums, where(_type: 'Album')
scope :categories, where(_type: 'Category')
+ # FIXME: Kinda hacky since this should belong in the album model
+ # but this allows for using this scope in chaining container criteria.
+ # There may be a way to do this differently in mongoid 3.
+ scope :with_images, excludes(image_count: 0)
+
slug :title, :parent do |doc|
doc.ancestors_and_self.collect(&:title).join(' ')
end

0 comments on commit 88a9475

Please sign in to comment.