Class: ActiveRecord::Generators::OauthProviderGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ActiveRecord::Generators::OauthProviderGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/active_record/oauth_provider_generator.rb
Class Method Summary collapse
-
.next_migration_number(dirname) ⇒ Object
Implement the required interface for Rails::Generators::Migration.
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_provider_generator.rb', line 11 def self.next_migration_number(dirname) #:nodoc: next_migration_number = current_migration_number(dirname) + 1 if ActiveRecord::Base. [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_collisions ⇒ Object
20 21 22 |
# File 'lib/generators/active_record/oauth_provider_generator.rb', line 20 def check_class_collisions class_collisions '', %w(ClientApplication OauthNonce RequestToken AccessToken OauthToken) end |
#copy_migration ⇒ Object
34 35 36 |
# File 'lib/generators/active_record/oauth_provider_generator.rb', line 34 def copy_migration migration_template 'migration.rb', 'db/migrate/create_oauth_tables' end |
#copy_models ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/active_record/oauth_provider_generator.rb', line 24 def copy_models template 'client_application.rb', File.join('app/models', 'client_application.rb') template 'oauth_token.rb', File.join('app/models', 'oauth_token.rb') template 'request_token.rb', File.join('app/models', 'request_token.rb') template 'access_token.rb', File.join('app/models', 'access_token.rb') template 'oauth2_token.rb', File.join('app/models', 'oauth2_token.rb') template 'oauth2_verifier.rb', File.join('app/models', 'oauth2_verifier.rb') template 'oauth_nonce.rb', File.join('app/models', 'oauth_nonce.rb') end |