Reputation: 2328
So many variables and conventions in rails look so similar to me. If something isn't working and I suspect a particular variable is the culprit, I might change it from
variable
to
@variable
or I might change
product_id
to
product.id
I'm really just shooting in the dark, though. I don't know exactly what is used where, and I'd really like to know the key concepts.
Upvotes: 1
Views: 74
Reputation: 40333
variable
Could be a local variable or a method in the current scope.
@variable
Is an instance variable, like any instance variables in any other class.
product_id
Is again a local variable or method in the current scope.
And the last one:
product.id
product could be a local variable or method and then you call the id method on it. You should probably invest more time trying to learn Ruby before trying to use Rails.
Upvotes: 2