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.
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.
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
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.