Linking Models

Hi…

I’m just starting with Rails 3.0.0.rc and am trying to get my models
to link as I did in previous rails releases…

I.e…

I used to be able to tell the model:
belongs_to :districts

then in the controller:
def index
@districts = District.find(:all)
@provers = Prover.find(:all)

end

then in the view have a line like:
<% @provers.each do |prover| %>
<%= prover.district.name %>

I’m expecting this to join the provers and districts tables so I can
return the district name instead of it’s foreign key id…!

At any rate, in rails 3 this no longer works…

crashbangboom wrote:

Hi…

I’m just starting with Rails 3.0.0.rc and am trying to get my models
to link as I did in previous rails releases…

[…]

At any rate, in rails 3 this no longer works…

When asking for help, never just say “it doesn’t work”. Always explain
how the actual behavior differs from the expected behavior. Include
error messages if any. Otherwise, it’s unlikely that anyone will be
able to help you.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]