bootswatch_rails 3.2.0.9 → 3.2.0.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60232bc73b47d3b4656dd3498d9bdcdf5bbb9fa6
|
4
|
+
data.tar.gz: df80d969c88617677b7f5cb07ebfca77e11ca21c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90a3a2da7c4633b33988d8f389333b6c43fa7e0bb5d0376e215317ff784d25ba83b998f4031766a63b8d410536696bae0ff0c227be209c2b21f066000293ce33
|
7
|
+
data.tar.gz: 6b90ff94b904769f85eaab1a291f9ef5144b0f84466dae57091ecfed90908b76380d0b1ac0513a81d6141d620b382a36a305f36ab0c9a497b9838a15950ca271
|
@@ -8,7 +8,7 @@ module BootswatchRails
|
|
8
8
|
desc: "The resource to be updated"
|
9
9
|
argument :user, type: :string, default: "user",
|
10
10
|
banner: "user model (default 'user')"
|
11
|
-
class_option :migration, type: :boolean, default:
|
11
|
+
class_option :migration, type: :boolean, default: false,
|
12
12
|
desc: 'Create a migration for added attributes'
|
13
13
|
source_root File.expand_path('../templates', __FILE__)
|
14
14
|
|
@@ -23,19 +23,20 @@ module BootswatchRails
|
|
23
23
|
|
24
24
|
def update_controller
|
25
25
|
file = "app/controllers/#{table_name}_controller.rb"
|
26
|
+
curr = "current_#{user}"
|
26
27
|
inject_into_file file, after: /def update$/ do
|
27
|
-
"\n @#{name}.updated_by =
|
28
|
+
"\n @#{name}.updated_by = #{curr} ? #{curr}.id : nil"
|
28
29
|
end
|
29
30
|
inject_into_file file, after: /@#{name} = #{class_name}\.new\(#{name}_params\)$/ do
|
30
|
-
"\n @#{name}.created_by =
|
31
|
-
"\n @#{name}.updated_by =
|
31
|
+
"\n @#{name}.created_by = #{curr} ? #{curr}.id : nil" +
|
32
|
+
"\n @#{name}.updated_by = #{curr} ? #{curr}.id : nil"
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
36
|
protected
|
36
37
|
|
37
38
|
def migration_name
|
38
|
-
"add_created_by_to_#{
|
39
|
+
"add_created_by_to_#{table_name}"
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|