ruby - How are these methods like create_table available in the Rails Migration class? -


How the methods and classes are defined in Ruby, and how to read an API document, this is a question. In short: how the create_table method is defined / imported / inherited, so it is available in the code in ActiveRecord :: migration :

  Create Class Products & lt; ActiveRecord :: Migration Def up_table: products do | T | T.string: name ...   

Coming from the world of Java, I was hoping to provide links to base classes or mixes where everything was defined. But if I look at the migration page, I see some handwritten documents, but there is no link from the most detailed, official definition of create_table . I used Google to find it in ActiveRecord :: ConnectionAdapters :: SchemaStatements , but even seeing the source code of two files:


< / P>

I do not think how to create_table to migrate . Itemprop = "text">

These methods are dynamically created in this class:

They are dynamically adding to the CommandRecorder class The lines are then:

  Class migration autoload: CommandRecorder, 'active_record / migrations / command_recorder'   

This provides for the migration class.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -