Class: Catptcha::PhotoGroup
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Catptcha::PhotoGroup
- Defined in:
- lib/catptcha/photo_group.rb
Overview
-
flickr_group_id
-
photos_updated_at
-
photos_count
Class Method Summary collapse
Class Method Details
.photos_count ⇒ Object
14 15 16 |
# File 'lib/catptcha/photo_group.rb', line 14 def self.photos_count sum(:photos_count) end |
.random(count) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/catptcha/photo_group.rb', line 18 def self.random count Catptcha::Photo.all( :conditions => ['photo_group_id in (?)', all.map(&:id)], :order => 'catptcha_photos.key ASC', :offset => rand(photos_count-count).to_i, :limit => count ) end |