In Ruby on Rails 5.2, migration files contain a class that looks like this.
class MyMigration < ActiveRecord::Migration[5.2]
I know that the [5.2]
syntax is specifying what version of rails the migration targets, but I don't understand how this works. Migration[5.2]
is not a valid Ruby class name.
What is this square bracket syntax, and how is it not causing ruby syntax errors?