I have a jbuilder view that returns json which is dynamically rendered in a partial. One of the json attributes is called in_list, which is a boolean value. I'd like to conditionally render a button depending on the value of that boolean. It looks like the boolean gets rendered as a string, but even when taking that into account, the conditional never works. If I render the in_list attribute as the text on the button tag, I can see that it does display True
or False
correctly, but when used in the conditional, it doesn't work.
code:
.text-center.product_picker_controlls
- if '{raw-in_list}' == 'true'
= button_tag 'ADDED', type: 'submit', class: 'btn btn-danger btn-lg t03e', id: 'product-{raw-product_id}'
-# %a.btn.btn-primary.btn-lg.t03e{ href: "#{products_path( list_id: args[:list].try(:id) || '0', success: 'back' )}&u={raw-id}", data: { method: :post } }
ADDED
- else
= button_tag 'ADD', type: 'submit', class: 'btn btn-primary btn-lg t03e', id: 'product-{raw-product_id}'
-# %a.btn.btn-primary.btn-lg.t03e{ href: "#{products_path( list_id: args[:list].try(:id) || '0', success: 'back' )}&u={raw-id}", data: { method: :post } }
ADD