138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/scaffold_logic/helper.rb', line 138
def to_params
params = ''
stack = []
each do |k, v|
next if v.blank?
if v.is_a?(Hash)
stack << [k,v]
elsif v.is_a?(Array)
v.each{|val| stack << ["#{k}[]",v]}
else
params << "#{k}=#{v}&"
end
end
stack.each do |parent, hash|
hash.each do |k, v|
next if v.blank?
if v.is_a?(Hash)
stack << ["#{parent}[#{k}]", v]
else
params << "#{parent}[#{k}]=#{v}&"
end
end
end
params.chop!
params
end
|