Don't know how to use if statement
I do not know how to use the if statement to compare the data to enter the
user with the database. I want to achieve that the user can enter the bar
code of a product and the application looks if that code is stored. If it
is found, you can send the following form, otherwise they send a warning
message to the user. This is form where you should go and its respective
controller.
Form which must be used if statement:
<%= @medicinas.each do |p| %>
INGRESE EL CÓDIGO DE BARRA DEL PRODUCTO QUE DESEA AGREGAR:
<% if codigo == @medicinas.codigo %>
INGRESE OTRO CÓDIGO DE BARRAS, EL QUE ESTA UTILIZANDO YA SE ENCUENTRA
ALMACENADO
<% else %> AGREGAR MEDICAMENTO end
Controller form:
def buscarcrear
@medicinas = Medicamentos.all
end
No comments:
Post a Comment