-
AppScreenshot
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 -
App:
class App < ActiveRecord::Base include Cacheable #acts_as_cached :ttl => 30.minutes has_many :apk_files has_many :app_screenshots.available end
why has_many :app_screenshots.available ?
:app_screenshots is just a Ruby symbol, so you can’t call methods on it like that.
I think something like
has_many :app_screenshots, :conditions => 'state > 0 and is_icon = 0'should work in your case.