0

In this post, I don't understand why ActiveRecord::Migration[5.0] class name doesn't throw a syntax error. Is that a legal ruby grammar? or what hack used with this?

Benjamin
  • 10,085
  • 19
  • 80
  • 130

2 Answers2

3

It's perfectly legal - it calls the class method [] for the ActiveRecord::Migration class. Have a look at the implementation.

eugen
  • 8,916
  • 11
  • 57
  • 65
2

[] is a class method of the Migration class

Edit @eugen was a bit quicker than me :-)

JanC
  • 345
  • 1
  • 6