AssociationTypeMismatch

Am getting the following error:
Modul(#36555780) expected, got String(#21132310)

After doing a lot of research on the net, i found that i need to pass
on the id field somehow, but i dont really know how to do it.

Following is the model:

class Modul < ActiveRecord::Base
belongs_to :modulable, :polymorphic => true
end

class Chapter < ActiveRecord::Base
has_many :moduls, :as => :modulable
accepts_nested_attributes_for :moduls
end

New Page:

New chapter

<% form_for @chapter do |chapter_form| %>
<%= chapter_form.error_messages %>

<% chapter_form.fields_for :moduls do |modul_form| %>
  <p>
    <%= modul_form.label :name %><br />
    <%= modul_form.text_field :name %>
  </p>
  <p>
    <%= modul_form.label :alias %><br />
    <%= modul_form.text_field :alias %>
  </p>
  <p>
    <%= modul_form.label :description %><br />
    <%= modul_form.text_field :description %>
  </p>
  <p>
    <%= modul_form.label :level %><br />
    <%= modul_form.select :level, %w{ nil 0 1 2 3 } %><br />
  </p>
  <p>
    <%= modul_form.label :parent %><br />
    <%= modul_form.text_field :parent %>
  </p>
  <% end %>
 <p>
<%= chapter_form.label :chapter_type %><br />
<%=

#@decodes = Decode.find(:all, :conditions => {:name =>
“Chapter_Type”, :is_active => 1 })
@decodes = Decode.all(:conditions => {:name =>
“Chapter_Type”, :is_active => 1 })
chapter_form.collection_select :chapter_type,
@decodes, :internal_value, :display_value, :prompt => ‘Select module
type’
%>

<%= chapter_form.submit 'Create' %>

<% end %>

<%= link_to ‘Back’, chapters_path %>

Controller:

class ChaptersController < ApplicationController

def create
@chapter = Chapter.new(params[:chapter])

respond_to do |format|
  if @chapter.save
    flash[:notice] = 'Chapter was successfully created.'
    format.html { redirect_to(@chapter) }
    format.xml  { render :xml => @chapter, :status

=> :created, :location => @chapter }
else
format.html { render :action => “new” }
format.xml { render :xml => @chapter.errors, :status
=> :unprocessable_entity }
end
end
end

end

Does anyone have an idea about the problem?

Thanks in advance,
Pratik