Incompatible character encodings

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 %>

Traitement <%= @i %>

<% fields_for “echantillon[treatment_attributes_updates][]”,
treatment do |treatment_form|%>
<% for c in @display_treatment %>


<%= c.first.first %> : <%=
text_field :treatment, c.first.second, :value =>
treatment[c.first.second] %>


<% end %>


<% 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] %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs