I have a problem with this type of field that is inside my form and it is that when trying to save that value inside my bd, I automatically assign a zero to this field, so it does not register the value that I want .
This is the code of my form.
<p>
<%= f.label :calificacion, "Calificacion",:class=>"etiqueta" %>
<br />
<%= f.number_field :calificacion,{:value => @calificacion,:step => '0.1', :class=>"caja"} %>
</p>
Next I will put the code of my method to store.
def create
@titulo = params[:pelicula][:titulo];
@calificacion = params[:pelicula][:calificacion];
@ano = params[:pelicula][:ano];
@pais = params[:pelicula][:pais];
@duracion = params[:pelicula][:duracion];
@genero = params[:pelicula][:genero];
@estreno = params[:pelicula][:estreno];
@fecha_estreno = params[:pelicula][:fecha_estreno];
@recomendacion = params[:pelicula][:recomendacion];
@sinopsis = params[:pelicula][:sinopsis];
@nota = params[:pelicula][:nota];
@status = params[:pelicula][:status];
@pelicula = Pelicula.new({
:titulo => @titulo,
:calificacion => @calificacion,
:ano => @ano,
:pais => @pais,
:duracion => @duracion,
:genero => @genero,
:estreno => @estreno,
:fecha_estreno => @fecha_estreno,
:recomendacion => @recomendacion,
:sinopsis => @sinopsis,
:nota => @nota,
:status=>@status
});
if @pelicula.save()
redirect_to peliculas_path, :notice => "La Pelicula ha sido insertada";
else
render "new";
end
end
And this is the way he inserts in my bd
The above data that is entered is due to the fact that before changing it to number_field it was a text_field