vendredi 20 novembre 2015

Rails Update action and IF statement

I just updated my drop down to include another option via my _form.html.erb partial, the post updates perfectly and saves everything into the database from what I can see from the rails console. The only problem is that the if statement I'm doing in my view seems to not recognise it?

I do have multiple if statements on my page.

My 'IF' Statement

  <% if offer.merchant == 'rakuten' %>
    <a href="win" target="_blank">
  <% else %>
    <a href="fail" target="_blank">
  <% end %>

_form.html.erb

  <div class="field">
    <%= f.label :merchant %><br>
    <%= f.select :merchant, options_for_select([["Webgains", "webgains"], ["CJ", "cj"], ["AW", "aw"],["Rakuten","rakuten"]], @offer.merchant) %>
  </div>

Rails Console

merchant: "rakuten"

Aucun commentaire:

Enregistrer un commentaire