class ActiveRecord::Generators::ActiveRecordMigrationGenerator
Public Instance Methods
create_pogs_migration()
click to toggle source
Invoke the active record migration generator
# File lib/generators/active_record/active_record_migration_generator.rb, line 10 def create_pogs_migration if Dir.glob("{db/migrate}/*_create_pogs.rb*").empty? invoke "active_record:migration", ["create_pogs"] insert_into_file Dir.glob("{db/migrate}/*create_pogs.rb*").last, migration_data, :after => "create_table :pogs do |t|\n" else puts "Migration for Pog already exists." end end
Private Instance Methods
migration_data()
click to toggle source
code to be added to the migration
# File lib/generators/active_record/active_record_migration_generator.rb, line 23 def migration_data <<-RUBY t.string :access_token t.datetime :access_token_expiration_time t.string :refresh_token t.string :analytics_view_id t.boolean :permission t.timestamps RUBY end