problem when editing record in polymorphic relation

I have the following three models created applying the polymorphic
concept

My Problem

In the edit.rhtml file, I am trying to populate the value of
'version',
an attribute in the software_ci table which is represented by the
content_type, SotwareCi. The sample code is given below.

<%= text_field ci.content, "version", "size" => 20 %>

text_field doesn't work that way - it expects the first parameter to
be the name of an instance variable
You should look into form_for since it allows you to escape that
convention

Fred

Frederick Cheung wrote:

That doesn't mean anything - you need
form_for :co, @ci.content, ... do |f|
f.text_field :name
end

If the form as a whole should apply to ci rather than its content then you can use fields_for to create the fields (without creating the <form> tag)

Fred

Frederick Cheung wrote:

Frederick Cheung wrote:

<% form_for :ci, @ci, :url => { :action => "update" } do |f| %>
  CI Name: <%= f.content.text_field :name %>
<% end %>

That doesn't mean anything - you need
form_for :co, @ci.content, ... do |f|
f.text_field :name
end

If the form as a whole should apply to ci rather than its content
then
you can use fields_for to create the fields (without creating the
<form> tag)

Fred

Fred......will you be able to show me a sample code that tells how a
record is to be edited when there exists a polymorphic relation as
shown
in the starting thread of this talk

The polymorphism is (I think) irrelevant, it's the fact that there is
an association. There is a good series on railscasts.com about complex
forms.

Fred

Frederick Cheung wrote: