Problema con variable en ruby on rails

Buenos Días, estoy haciendo una aplicación de pedidos en linea en Ruby
On Rails y tengo un problema que no e podido solucionar

Mi problema son el manejo de las variables en rails.

uno de los inconvenientes es que tengo un (select_tag) que lista los
descuentos (0, 10, 15) que se le otorgara al cleinte y que se le
aplicaran a el costo de los productos, pero primero no se como capturar
el valor que el usuario eligió del (select_tag) para restarlo al valor
del producto y segundo no se como guardar ese valor en la base de datos,
ya tengo un campo descuento.

el codigo que tengo es:

<%= select_tag “listadescuento”,options_for_select([ “0”, “10”, “15” ],
“0” %>

la pregunta como le asigno el valor que escogió el usuario a una
variable
o hay un método que me devuelva ese valor

gracias por su atencion

2014-10-15 21:56 GMT+01:00 Esteban P. [email protected]:

ya tengo un campo descuento.

el codigo que tengo es:

<%= select_tag “listadescuento”,options_for_select([ “0”, “10”, “15” ],
“0” %>

I don’t understand your question but you have missed a closing
parenthesis ‘)’ to match options_for_select( … so I would expect a
syntax error to be shown.

Colin

hi colin
my problem is: I need to capture the value of <% = select_tag “list”,
options_for_select ([“0”, “10”, “15”], “0”)%>
in a variable, to calculate the value of the product

conclucion the user chooses in the 0 or 10 or 15 and I need to capture
that number as a variable

thank you very much

On Oct 15, 2014, at 5:58 PM, Esteban P. [email protected]
wrote:

hi colin
my problem is: I need to capture the value of <% = select_tag “list”,
options_for_select ([“0”, “10”, “15”], “0”)%>
in a variable, to calculate the value of the product

conclucion the user chooses in the 0 or 10 or 15 and I need to capture
that number as a variable

thank you very much

You would “capture” that value in your controller when you handle the
form submitted by the user, so in your #create or #update methods.
Whatever that form field is named will be submitted in the params hash,
with the value set to their choice.

If you are talking about capturing the setting before they submit the
form, then you are into the realm of JavaScript, and in Rails this is
usually handled in an unobtrusive JS handler. Read up on Ajax and Rails
for more details about that.

Walter