avo-setup 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
data/lib/avo-setup/version.rb
CHANGED
@@ -18,6 +18,8 @@ module Avo
|
|
18
18
|
if yes?("Would you like to use CanCan")
|
19
19
|
gem("cancan")
|
20
20
|
copy_file "ability.rb", "models/ability.rb"
|
21
|
+
@single=model_name
|
22
|
+
@plural=model_name.pluralize
|
21
23
|
migration_template 'create_roles_migration.rb', "db/migrate/create_roles.rb"
|
22
24
|
end
|
23
25
|
end
|
@@ -4,8 +4,8 @@ class CreateRolesMigration < ActiveRecord::Migration
|
|
4
4
|
t.string :title
|
5
5
|
t.timestamps
|
6
6
|
end
|
7
|
-
create_table :
|
8
|
-
t.integer
|
7
|
+
create_table :roles_<%= @plural %>, :force => true do |t|
|
8
|
+
t.integer :<%= @single %>_id
|
9
9
|
t.integer :role_id
|
10
10
|
t.timestamps
|
11
11
|
end
|
@@ -13,7 +13,7 @@ class CreateRolesMigration < ActiveRecord::Migration
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.down
|
16
|
-
drop_table :
|
16
|
+
drop_table :roles_<%= @plural %>
|
17
17
|
drop_table :roles
|
18
18
|
end
|
19
19
|
end
|