scaffold_plus 1.4.5 → 1.4.6
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: 1f3677379c215a0c304965c6ac5b502b6fa5f7de
|
4
|
+
data.tar.gz: b8201a2f5f7c6fc982efc900a223070e2e3d8258
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 058c4629b77624d4c937ce80167b913d076589d111bf248167a1bc1e86854f9b75d8623ed99d5063e8cbf5e1392c2548c784318bca300b48b35e0155de546951
|
7
|
+
data.tar.gz: 3fd999421926d09422fa8095171593345989d2c276ee1e4f29e251b4189eae4a6694986e88700a77c2a1d3df7d02ab6cb3fa57a655b2fe63c84478668b4bb49a
|
@@ -23,10 +23,22 @@ module ScaffoldPlus
|
|
23
23
|
|
24
24
|
def add_to_model
|
25
25
|
[ "created", "updated" ].each do |action|
|
26
|
+
user_name = "#{user.camelize}.find(#{action}_by).try('name')"
|
27
|
+
user_mail = "#{user.camelize}.find(#{action}_by).try('email')"
|
26
28
|
lines = options.before? ? [ "" ] : []
|
27
29
|
lines << [
|
28
30
|
" def #{action}_by_name",
|
29
|
-
" #{
|
31
|
+
" #{user_name}",
|
32
|
+
" end",
|
33
|
+
""
|
34
|
+
]
|
35
|
+
lines << [ "" ] if options.after?
|
36
|
+
inject_into_class "app/models/#{name}.rb", class_name, lines.join("\n")
|
37
|
+
|
38
|
+
lines = options.before? ? [ "" ] : []
|
39
|
+
lines << [
|
40
|
+
" def #{action}_by_email",
|
41
|
+
" #{user_name} <#{user_email}>",
|
30
42
|
" end",
|
31
43
|
""
|
32
44
|
]
|