verify if backend method is true and not client as well

0

I have a code that on my backend it returns true or false, I'm working with ruby and rails 5.

So I have it's an if or so ja:

<% if @order? %>
    <h2> teste 2 <h2>
<%else>
    <h1>teste 1</h1>
<%end>

But what I want to do is the following if it is true in the backend check if the frontend is too and add the result true or false inside that if in .erb

something like this:

<% if @order? && var ou algo que retornar true no lado do client  %>
    <h2> teste 2 <h2>
<%else>
    <h1>teste 1</h1>
<%end>

If you have any other ideas on how to do this, you will be very welcome.

    
asked by anonymous 05.11.2015 / 18:06

1 answer

1

This is a bad practice. However, there it goes:

<script>
if(<%@order> === variavelClient && variavelClient){
console.log('são iguais e verdadeiras')
}
</script>
    
06.11.2015 / 01:30