# What's the meaning of @@?

**URL:** <https://www.ruby-forum.com/t/whats-the-meaning-of/142894>\
**Category:** Rails\
**Created:** [July 12, 2008, 10:20pm UTC](https://www.ruby-forum.com/t/whats-the-meaning-of/142894 "2008-07-12T22:20:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lz-coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@lz-coelho](https://www.ruby-forum.com/u/lz-coelho)\
**Post date:** [July 12, 2008, 10:20pm UTC](https://www.ruby-forum.com/t/whats-the-meaning-of/142894/1 "2008-07-12T22:20:41Z")

</div>

I’m reading several files from RubyOnRails package, and this code:

```
@@default_error_messages = {
  :inclusion => "is not included in the list",
  :exclusion => "is reserved",
  :invalid => "is invalid",
  :confirmation => "doesn't match confirmation",
  :accepted => "must be accepted",
  :empty => "can't be empty",
  :blank => "can't be blank",
  :too_long => "is too long (maximum is %d characters)",
  :too_short => "is too short (minimum is %d characters)",
  :wrong_length => "is the wrong length (should be %d characters)",
  :taken => "has already been taken",
  :not_a_number => "is not a number",
  :greater_than => "must be greater than %d",
  :greater_than_or_equal_to => "must be greater than or equal to 

```

%d",  
:equal\_to =\> “must be equal to %d”,  
:less\_than =\> “must be less than %d”,  
:less\_than\_or\_equal\_to =\> “must be less than or equal to %d”,  
:odd =\> “must be odd”,  
:even =\> “must be even”  
}

What’s the meaning of @@? Double instantiated?

–  
Regards,

Luiz Vitor Martinez C.  
cel.: (11) 8187-8662  
blog: [rubz.org](http://rubz.org)  
engineer student at maua.br

---

<div class="post-metadata">

**Author:** ![lz-coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@lz-coelho](https://www.ruby-forum.com/u/lz-coelho)\
**Post date:** [July 12, 2008, 10:29pm UTC](https://www.ruby-forum.com/t/whats-the-meaning-of/142894/2 "2008-07-12T22:29:27Z")

</div>

Hi–

On Sat, 12 Jul 2008, Luiz Vitor Martinez C. wrote:

> ```
> :too_long => "is too long (maximum is %d characters)",
> :even => "must be even"
> 
> ```
> 
> }
> 
> What’s the meaning of @@? Double instantiated?

@@var is a class variable. It’s got a somewhat odd visibility pattern:  
it’s visible to the class it’s defined in, all subclasses of that  
class, and all instances of the above. It’s a quick-‘n’-easy way to  
store data that both a class and its instances can see, but it’s got a  
kind of quasi-global (or hierarchy-global) quality to it that makes it  
a bit error-prone.

David

–  
Rails training from David A. Black and Ruby Power and Light:  
Intro to Ruby on Rails July 21-24 Edison, NJ  
Advancing With Rails August 18-21 Edison, NJ  
See [http://www.rubypal.com](http://www.rubypal.com) for details and updates!

---

<div class="post-metadata">

**Author:** ![lz-coelho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/8c91f0/32.png) [@lz-coelho](https://www.ruby-forum.com/u/lz-coelho)\
**Post date:** [July 12, 2008, 10:35pm UTC](https://www.ruby-forum.com/t/whats-the-meaning-of/142894/3 "2008-07-12T22:35:54Z")

</div>

On 12 Jul 2008, at 21:20, Luiz Vitor Martinez C. wrote:

> What’s the meaning of @@? Double instantiated?

Nope. [Ruby | zenspider.com | by ryan davis](http://www.zenspider.com/Languages/Ruby/QuickRef.html#16)

Fred
