ruby on rails - Confused about the ways to write code for instance variables -
i quite confused on how 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 curious difference between (i) subject_name @item , (ii) @item.price?
is not supposed @item.subject_name?
i expect subject_name
isn't variable, method. guess have method subject_name
defined in 1 of helper files takes argument - @item
in example.
Comments
Post a Comment