I am getting an error

incompatible character encodings: ASCII-8BIT and UTF-8

when I try to render a partial view for the children objects of a main
object's edit page.

This is the controller method :

  def update
  @display_treatment = [
         {"exam type"=>"treatmenttype"} ,
         {"preparation comments"=>"preparation"},
         {"preparation nature"=>"natureprep"} ,
         {"reference cut"=>"refCoupe"},
         {"author"=>"author"},
         ]

    @echantillon = Echantillon.find(params[:id])
    @treatments = Treatment.find(:all, :conditions => ['echantillon_id
= ?', @echantillon.id])

    respond_to do |format|
      if @echantillon.update_attributes(params[:echantillon])
        flash[:notice] = 'Echantillon was successfully updated.'
        format.html { redirect_to(@echantillon) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @echantillon.errors, :status
=> :unprocessable_entity }
      end
    end
  end

and this is in the edit view:

      <%=  render  :partial => 'treatmentupdate', :locals =>
{:treatments => @echantillon.treatments} %>

and this is the partial:

<% @i = 1 %>
<% for treatment in @treatments %>

  <tr><td colspan="2"><h2>Traitement <%= @i %> </h2></td></tr>

   <% fields_for "echantillon[treatment_attributes_updates][]",
treatment do |treatment_form|%>
      <% for c in @display_treatment %>
       <tr>
       <td class ="name"> <%= c.first.first %> : </td><td></td><td><%=
text_field :treatment, c.first.second, :value =>
treatment[c.first.second] %></td>
       <td></td>
       </tr>
      <% end %>
     <tr><td colspan="3"><hr/></td></tr>
   <% end %>
 <% @i = @i + 1 %>
<% end %>

I am getting the error on this line:

       <td class ="name"> <%= c.first.first %> : </td><td></td><td><%=
text_field :treatment, c.first.second, :value =>
treatment[c.first.second] %></td>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to