Hi,
I have a user class as so:
class Artisttbl < ActiveRecord::Base set_primary_key “artist_id” has_one :artistbiogtbl, :foreign_key => “artist_id”, :dependent => :delete has_many :artistimagestbl, :foreign_key => “artist_id”, :dependent => :delete_all
has_many :trackcounttbl, :foreign_key => “artist_id”, :dependent => :delete_all has_many :stocktbl, :foreign_key => “artist_id”, :dependent => :delete_all
def self.getFeaturedArtist
Artisttbl.find(:first, :include => [:artistbiogtbl, :artistimagestbl, :stocktbl[:conditions => ['stock_id = ?', :stock_id]]], :conditions => {:featured => 'true'})
end
end
I am getting the above mentioned error message whn trying to perform getFeaturedArtist. What I am trying to do is:
- Find a ‘featured’ artist record and to ‘include’ an associated artistbiogtbl record, artistimagtbl record and stocktbl record. But on the stocktbl I wish a condition to be set which is simply that the Stocktbl.stock_id must be equal to the Artisttbl.stock_id.
What is the best way to do this?