AppScreenshot軌HAS_MANY範圍
class AppScreenshot < ActiveRecord::Base include Cacheable belongs_to :app model_cache do with_key end scope :available , where(["state > ? and is_icon = ? ",0,0]) end
應用:
class App < ActiveRecord::Base include Cacheable #acts_as_cached :ttl => 30.minutes has_many :apk_files has_many :app_screenshots.available end
爲什麼has_many :app_screenshots.available
?