Class: RbacRls::Generators::CustomMigrationGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Rails::Generators::Migration, GeneratorHelpers
Defined in:
lib/generators/rbac_rls/custom_migration_generator.rb

Instance Attribute Summary collapse

Attributes included from GeneratorHelpers

#attributes, #options

Instance Method Summary collapse

Instance Attribute Details

#time_nowObject

Returns the value of attribute time_now.



39
40
41
# File 'lib/generators/rbac_rls/custom_migration_generator.rb', line 39

def time_now
  @time_now
end

Instance Method Details

#migration_define_templateObject



54
55
56
57
58
59
60
61
# File 'lib/generators/rbac_rls/custom_migration_generator.rb', line 54

def migration_define_template
  attrs = attributes.map { |i| i.name }
  str = attrs.join('_')

  migration_template('../templates/rls_migration.rb',
                     File.join('db/migrate', "create_#{name.underscore}_#{options[:permission_identifier]}_policy.rb")
  )
end