vendredi 28 juin 2019

Why is my Ruby on Rails condition not working on view folder?

Regarding a Ruby on rails app, I'm using if statements on the different view files of the same view folder.

The condition is working well for all files in my folder except one for which it is not. Here is the code lines :

- else
  .row
    .col-xs-12.text-center
    - if @progress_board.cover_image.present? ##<--- This one is not working ##
      %h4[...]
    - else
      %h4[...]

Note : this is haml

  • I tested with another condition involving progress_board. It didn't work.

  • I tested with another condition from the issue file himself. Worked.

=> My syntax is good. The issue comes from @progress_board.

Since the file is using a JS tool to display charts it may be the origin of the problem.

Maybe it's a stupid issue but I'm new to RoR, trying to understand. Should I declare some variable at some points ?

Thank you for helping !

Aucun commentaire:

Enregistrer un commentaire