Class: ActiveRecord::Generators::OauthConsumerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/active_record/oauth_consumer_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object

Implement the required interface for Rails::Generators::Migration.



11
12
13
14
15
16
17
18
# File 'lib/generators/active_record/oauth_consumer_generator.rb', line 11

def self.next_migration_number(dirname) #:nodoc:
  next_migration_number = current_migration_number(dirname) + 1
  if ActiveRecord::Base.timestamped_migrations
    [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
  else
    "%.3d" % next_migration_number
  end
end

Instance Method Details

#check_class_collisionsObject



20
21
22
# File 'lib/generators/active_record/oauth_consumer_generator.rb', line 20

def check_class_collisions
  class_collisions '', %w(ConsumerToken)
end

#copy_migrationObject



28
29
30
# File 'lib/generators/active_record/oauth_consumer_generator.rb', line 28

def copy_migration
  migration_template 'migration.rb', 'db/migrate/create_oauth_consumer_tokens'
end

#copy_modelsObject



24
25
26
# File 'lib/generators/active_record/oauth_consumer_generator.rb', line 24

def copy_models
  template 'consumer_token.rb', File.join('app/models', 'consumer_token.rb')
end