scaffold_plus 1.4.5 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ece67e8ad92aaaf99c68934edf293e7ebbfa16a
4
- data.tar.gz: 97feb823ba89960e10150d7cf404f1318896377c
3
+ metadata.gz: 1f3677379c215a0c304965c6ac5b502b6fa5f7de
4
+ data.tar.gz: b8201a2f5f7c6fc982efc900a223070e2e3d8258
5
5
  SHA512:
6
- metadata.gz: 79a7f459acc1316ade8f590102a17deb61dd4af13ec148fd993ec86ae95251c44a8db4f145bbd9686fd8ce6e91beb5b4ef19f44883179a2a6d253c32bdcfd1da
7
- data.tar.gz: 9ce59164c5722ffb7382072563a9c6c287118e286156717fd9178a1cd8300670a412de88acbfbbc2c5498224f5edbf826782a13273533d180d3e9ba5fd965ab0
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
- " #{user.camelize}.find(#{action}_by).try('name')",
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
  ]
@@ -1,3 +1,3 @@
1
1
  module ScaffoldPlus
2
- VERSION = "1.4.5"
2
+ VERSION = "1.4.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffold_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volker Wiegand