Class: YallaAuthRubyClient::Generators::UserGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- YallaAuthRubyClient::Generators::UserGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/yalla_auth_ruby_client/user_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.next_migration_number(dirname) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/generators/yalla_auth_ruby_client/user_generator.rb', line 10 def self.next_migration_number(dirname) if ActiveRecord. Time.now.utc.strftime("%Y%m%d%H%M%S") else sprintf("%03d", current_migration_number(dirname) + 1) end end |
Instance Method Details
#create_migration_file ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/generators/yalla_auth_ruby_client/user_generator.rb', line 18 def create_migration_file unless File.exist?(File.join(destination_root, 'app/models/app_user.rb')) say_status :error, 'AppUser model not found. Please create app/models/app_user.rb before running this generator.', :red return end migration_template 'add_yalla_id_to_app_users.rb', 'db/migrate/add_yalla_id_to_app_users.rb' end |