I have an object that I save like this in my controller:
@user = User.find(params[:id])
and when it comes time to display it, using HAML, I am trying to do something like this:
-@user.first_name
but nothing gets rendered. What am I doing wrong? I saw many examples using the @user in a form. Should I do that even though I don’t have a form to create in this case? Or I also saw a lot of places that use the :some_var notation, but I am not certain which approach applies in this case.
Use equal sign instead of minus
Minus does not output anything to the HTML, it ignores returned value. Equal sign does emit returned value to the HTML.