On Fri, Nov 06, 2009 at 01:23:25AM +0100, Aljaz Fajmut wrote:

> human table: id weight size
> person table: id name surname address

If I understand your question correctly, you need to build the right
relationships. If you lived in the Star Trek universe, you might have:

    class Person < ActiveRecord::Base
        belongs_to :race
    end
    class Race < ActiveRecord::Base
        has_many :people
    end

where @person.race.name should return "human" if you've populated the
race table and created a foreign key in person named "race_id".

-- 
"Oh, look: rocks!"
        -- Doctor Who, "Destiny of the Daleks"


--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to