Possible Duplicate:
Difference between class variables and class instance variables?
I would like to understand the difference here:
class Blog
class << self
def tags (default_tags)
@tags ||= default_tags
end
end
end
Now, Blog.tags always return what was initially assigned. Since I am playing around with Rails, that is the case for every request.
the @tags above is class level instance variable and seem to act similar to @@tags, which is class variable. Are they in fact same? is there any difference one should be aware of between the two, and to decide which one to chose over the other?
Or am I completely wrong in my understanding?
ps: This is apparently a made up example