[Rails] Confused...

Mike Harris
Thu, 05 Jan 2006 22:48:35 -0000

It would be helpful to give more information about how it''s not
working.

Jeff Wood wrote:

>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
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>