[Rails] Confused...

Jeff Wood
Thu, 05 Jan 2006 22:32:38 -0000

Ok,

So, I''ve got two data tables associated through a foreign key.

class Child < ActiveRecord::Base
  belongs_to :parent, :class => Parent, :foreign_key =>
"parent_id"
  # also has attr1, attr2
end

class Parent < ActiveRecord::Base
  has_many :children, :class => Child, :foreign_key =>
"parent_id"
end

So, I''m trying to build the new/edit form for the child table...

Basically, I was aiming for something like:

<%= text_field "child", "id", :locked =>
"true" %>
<%= text_field "child.parent", "id", :locked =>
"true" %>
<%= text_field "child", "attr1" %>
<%= text_field "child", "attr2" %>


but, that isn''t working ... Can anybody enlighten me ?

j.

--
"Remember. Understand. Believe. Yield! -> http://ruby-lang.org"

Jeff Wood