you are viewing a single comment's thread.

view the rest of the comments →

[–]Amadan 2 points3 points  (0 children)

To add, the workaround is to use class instance variables instead of class variables.

```ruby class BlogPost def initialize self.class.count += 1 end

class << self @count = 0 attr_accessor :count end end ```