Forum: Ruby on Rails Get an object other than primary key ID

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F71ecec26b3ddeed6754c20f7133ebaf?d=identicon&s=25 karthik chigurupati (Guest)
on 2008-10-31 09:24
(Received via mailing list)
Hello,
         i want to retrieve and object from a table other than primary
key ID.

eg:     @sites.each do |@site|
          @site_id = @site.id
          @tower = Tower.find(:all, :conditions => ["site_id =?",
@site_id])

Tower Belongs to Site. so Site_id is a reference in tower object.
there will be only one Tower object for Site Object.

Should we give relation as has_obne in site model??

help me ot.

Karthik
This topic is locked and can not be replied to.