I am quite confused on how we write instance variables in Rails.
Posted by: <%= link_to(@item.user.username, store_path(@item.user)) %>
Price: <%= number_to_currency @item.price %>
vs
Subject: <%= subject_name @item %>
I am just curious what is the difference between (i) subject_name @item and (ii) @item.price?
Is it not supposed to be @item.subject_name?
I would expect that subject_name
isn't a variable, but a method. I guess you have a method subject_name
defined in one of your helper files that takes an argument - @item
in this example.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments