Class: AuthAssist::RoleMigrations::RoleAssignment
- Inherits:
-
Base
- Object
- Base
- AuthAssist::RoleMigrations::RoleAssignment
show all
- Defined in:
- lib/generators/role_migrations.rb
Instance Attribute Summary
Attributes inherited from Base
#generator
Instance Method Summary
collapse
Methods inherited from Base
#generate_reverse_migration, #initialize, #setup
#copy_migration, #file_reverse, #find_migration, included, #migration, #migration_dir, #migration_exists?, #reverse_migration_methods
#clear_user_relations, #erase_in_user, #has_role_assignments, #has_roles, #has_roles_through_assignments, #insert_user_relation, #remove_user_relation, #role_assignment_file_content, #role_file_content, #write_model_file
Instance Method Details
119
120
121
122
|
# File 'lib/generators/role_migrations.rb', line 119
def configure
generate_role_model
insert_user_relation(has_roles)
end
|
#migration_names ⇒ Object
110
111
112
|
# File 'lib/generators/role_migrations.rb', line 110
def migration_names
['add_role_id_to_user', 'create_roles']
end
|
124
125
126
127
|
# File 'lib/generators/role_migrations.rb', line 124
def reverse_configure
remove_role_model
remove_user_relation(has_roles)
end
|
#reverse_migration ⇒ Object
129
130
131
|
# File 'lib/generators/role_migrations.rb', line 129
def reverse_migration
migration_template 'remove_role_assignments_migration.rb', 'remove_role_assignments'
end
|
#run_migration ⇒ Object
114
115
116
117
|
# File 'lib/generators/role_migrations.rb', line 114
def run_migration
migration 'add_role_id_to_user role_id:integer'
migration 'create_roles name:string'
end
|