ruby - Learning rails. Differences between, for instance, product, :product, @product, product.id, product_id -


so many variables , conventions in rails similar me. if isn't working , suspect particular variable culprit, might change from

variable 

to

@variable 

or might change

product_id 

to

product.id 

i'm shooting in dark, though. don't know used where, , i'd know key concepts.

variable 

could local variable or method in current scope.

@variable 

is instance variable, instance variables in other class.

product_id 

is again local variable or method in current scope.

and last one:

product.id 

product local variable or method , call id method on it. should invest more time trying learn ruby before trying use rails.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

javascript - Preserving URL fragment through CAS sign-on -

asp.net mvc - Implementing normal user/pass, Twitter & Facebook auth -