scaffold_plus 2.1.1 → 2.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 450cf4b87abe4a2a86ad00fe8b053a71c6fba8c7
|
4
|
+
data.tar.gz: 74a215ecd8504a343c96ce597d8135208b0c0d36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 398ecfa0f85c0d931fabc4a844e1864a10851fe758d97e6478d270e3d29758c38f1da2c212ace792473d0edb462f97a1f498b6ed41d1d5f09f786605b0c59e24
|
7
|
+
data.tar.gz: d8af2ce1c3b5ed8455c80edd10d0bd0da937a82eb44f649ab10518ed24a39693589596b4efecf22868036d37b1d3496c2aba6dc9f0109c37d0d38aed4d29e0d3
|
@@ -86,6 +86,7 @@ module ScaffoldPlus
|
|
86
86
|
list = options.nested.map{|n| ":#{n}"}.join(', ')
|
87
87
|
text = "#{children}_attributes: [ #{list} ]"
|
88
88
|
file = "app/controllers/#{table_name}_controller.rb"
|
89
|
+
return unless File.exist?(file)
|
89
90
|
gsub_file file, /(permit\(.*)\)/, "\\1, #{text})"
|
90
91
|
# Special case: no previous permit
|
91
92
|
gsub_file file, /^(\s*params)\[:#{name}\]$/, "\\1.require(:#{name}).permit(#{text})"
|
@@ -95,6 +96,7 @@ module ScaffoldPlus
|
|
95
96
|
return unless options.permit?
|
96
97
|
text = ":#{name}_id"
|
97
98
|
file = "app/controllers/#{children}_controller.rb"
|
99
|
+
return unless File.exist?(file)
|
98
100
|
gsub_file file, /(permit\(.*)\)/, "\\1, #{text})"
|
99
101
|
# Special case: no previous permit
|
100
102
|
gsub_file file, /^(\s*params)\[:#{name}\]$/, "\\1.require(:#{name}).permit(#{text})"
|
@@ -104,16 +106,20 @@ module ScaffoldPlus
|
|
104
106
|
return unless options.route?
|
105
107
|
child = children.singularize
|
106
108
|
file = "app/controllers/#{children}_controller.rb"
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
109
|
+
if File.exist?(file)
|
110
|
+
gsub_file file, /GET .#{children}.new$/ do |match|
|
111
|
+
match = "GET /#{table_name}/:id/#{children}/new"
|
112
|
+
end
|
113
|
+
gsub_file file, /^ @#{child} = #{child.camelize}.new$/ do |match|
|
114
|
+
match = " @#{name} = #{class_name}.find(params[:#{name}_id])\n" +
|
115
|
+
" @#{child} = @#{name}.#{children}.build"
|
116
|
+
end
|
113
117
|
end
|
114
118
|
file = "app/views/#{children}/_form.html.erb"
|
115
|
-
|
116
|
-
|
119
|
+
if File.exist?(file)
|
120
|
+
gsub_file file, /form_for\(@#{child}/ do |match|
|
121
|
+
match = "form_for([@#{name}, @#{child}]"
|
122
|
+
end
|
117
123
|
end
|
118
124
|
end
|
119
125
|
|
@@ -145,3 +151,5 @@ module ScaffoldPlus
|
|
145
151
|
end
|
146
152
|
end
|
147
153
|
end
|
154
|
+
|
155
|
+
# vim: set expandtab softtabstop=2 shiftwidth=2 autoindent :
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scaffold_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Volker Wiegand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
150
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.6.
|
151
|
+
rubygems_version: 2.6.8
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: A collection of helpers for Rails scaffolding
|