Hi Folks,
I have a game where users get access to technologies. The technology records aren't owned - so a normal foreign key doesn't make sense.
I want to tell rails not to bother with xxx_id, and just to use conditions I set.
I can use finder_sql for a has_many base.has_many :superstructures, :class_name => 'Technology', :finder_sql => "select * from technologies where category = 'Superstructure'" do def allowed find :all, :conditions => 'research_required < 2' end end
but the 'allowed' addition doesn't work
For a has_one, finder_sql doesn't seem to be an allowed option.
What I'd like is :foreign_key => nil, then I could put my logic in :conditions -but that doesn't seem to work either - rails just guesses the default key.
Is there a way to do this without just defining class methods on Technology?
Thanks.