Association and legacy database

hi all,

I’m stuck with this:

in environment.rb I have:

Inflector.inflections do |inflect|
inflect.plural /istituto/, ‘istituti’
inflect.plural /Istituto/, ‘Istituti’

    inflect.irregular 'Istituto', 'Istituti'
    inflect.irregular 'istituto', 'istituti'

    inflect.plural /sede/, 'sedi'
    inflect.plural /Sede/, 'Sedi'

    inflect.irregular 'Sede', 'Sedi'
    inflect.irregular 'sede', 'sedi'

end

my models are:

istituto.rb
class Istituto < ActiveRecord::Base
has_many :sedi
end

sede.rb
class Sede < ActiveRecord::Base
set_primary_key “istituto_id”
belongs_to :istituti
end

now if I run ./script/console and execute Istituto.find :all, my query
is
SELECT * FROM istituti and does not do the join with sedi

I think I have not understood well the whole mechanism, please shed some
light
thanks! :slight_smile:

ciao,
Marco


,= ,--. =. ------------------------------------------------------- +
((
/)o o(_)) jabber:[email protected]/msn:[email protected] |
-'(. .)- #removed_email_address@domain.invalid |
_/ There’s no one inside that flat, everybody knows it |

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs