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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---