Class: TagAuth::Generators::TagAuthGenerator

Inherits:
ActiveRecord::Generators::Base
  • Object
show all
Defined in:
lib/generators/tag_auth/tag_auth_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_tag_auth_migrationObject



12
13
14
15
16
# File 'lib/generators/tag_auth/tag_auth_generator.rb', line 12

def copy_tag_auth_migration
  migration_template 'add_auth_tag_and_token_migration.rb.erb',
                     "#{migration_path}/add_auth_tag_and_token_to_#{file_path.pluralize}.rb",
                     migration_version: migration_version
end

#migration_pathObject



18
19
20
# File 'lib/generators/tag_auth/tag_auth_generator.rb', line 18

def migration_path
  File.join('db', 'migrate')
end

#migration_versionObject



22
23
24
25
26
# File 'lib/generators/tag_auth/tag_auth_generator.rb', line 22

def migration_version
  return unless Rails::VERSION::MAJOR >= 5

  "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
end