Forum: Rails-ES esta humanizando nombre de campo al actualizar

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Angel Mauricio Pino Gonzalez (Guest)
on 2009-04-21 00:31
(Received via mailing list)
Tengo rails 2.3.2
Ruby 1.8.6
SO WXP

y me pasa lo siguiente :

rocessing ComerciosController#update (for 127.0.0.1 at 2009-04-20
16:17:07)
[PUT]
  Parameters: {"commit"=>"Guardar",
"authenticity_token"=>"pukNdGBZFu5cF23GCTNpd+izLvL5s5a2vGea36Etd6E=",
"id"=>"1", "comercio"=>{"mediosdepago_id"=>"1", "banco_id"=>"1",
"cuenta_bco"=>"008393837", "nombre_fantasia"=>"Ampino",
"razon_social"=>"Angel Pino", "rut"=>"11111111"}}
  Usuario Columns (16.0ms)   SHOW FIELDS FROM
`usuarios`
  Usuario Load (0.0ms)   SELECT * FROM `usuarios` WHERE
(`usuarios`.`id` = 1) LIMIT 1
  Comercio Columns (15.0ms)   SHOW FIELDS FROM
`comercios`
  Comercio Load (0.0ms)   SELECT * FROM `comercios`
WHERE
(`comercios`.`id` = 1) 
  SQL (16.0ms)   BEGIN
  Comercio Exists (78.0ms)   SELECT `comercios`.id FROM
`comercios` WHERE (`comercios`.`rut` = 11111111 AND `comercios`.id <> 1)
LIMIT 1
  SQL (16.0ms)   ROLLBACK

NoMethodError (undefined method `razón_social' for
#<Comercio:0x4950b10>):
  app/controllers/comercios_controller.rb:100:in `update'
  app/controllers/comercios_controller.rb:99:in `update'
  -e:2:in `load'
  -e:2

Rendered rescues/_trace (578.0ms)
Rendered rescues/_request_and_response (0.0ms)
Rendering rescues/layout (internal_server_error)

# PUT /comercios/1
  # PUT /comercios/1.xml
  def update
    @comercio = Comercio.find(params[:id])

    respond_to do |format|
      if @comercio.update_attributes(params[:comercio])     <--- Linea
100
        flash[:notice] = 'Comercio actualizado.'
        format.html { redirect_to(comercios_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @comercio.errors, :status =>
:unprocessable_entity }
      end
    end
  end


En la actualización esta humanizando el nombre del campo razon_social,
pero
poniendole acento a razón, si ven lo que manda el browse dice
"razon_social"
sin acento?
Hace dias que tengo este problema y deberas no se por donde incarle el
diente.
Cualquier sugerencia será muy bien benida.
Gracias
Angel Mauricio Pino Gonzalez (Guest)
on 2009-04-21 00:41
(Received via mailing list)
Y no es la estructurta de la tabla, aca la adjunto:
"Field","Type","Null","Key","Default","Extra"
"id","int(11)","NO","PRI",,"auto_increment"
"rut","int(11)","YES","",,""
"razon_social","varchar(50)","YES","",,""
"nombre_fantasia","varchar(50)","YES","",,""
"banco_id","int(11)","YES","",,""
"mediosdepago_id","int(11)","YES","",,""
"cuenta_bco","varchar(30)","YES","",,""
"created_at","datetime","YES","",,""
"updated_at","datetime","YES","",,""

Como pueden ver tbn esta escrito correctamente sin acento.

2009/4/20 Angel Mauricio Pino Gonzalez
<removed_email_address@domain.invalid
>
Emili P. (Guest)
on 2009-04-21 12:17
(Received via mailing list)
No está humanizando nada, Rails todavia no es tan listo para saber que
razón
lleva acento , pero todo llegará;)
En algun sitio estás llamando a un metodo de la clase Comercio que se
llama
razón_social

Tienes algun callback en el modelo? busca en tu editor "def
razón_social" a
ver si es que le has puesto el acento al nombre del método.



2009/4/20 Angel Mauricio Pino Gonzalez
<removed_email_address@domain.invalid
>
This topic is locked and can not be replied to.