Skip to content

Commit

Permalink
Merge pull request #7213 from bdunne/to_miq_a
Browse files Browse the repository at this point in the history
Prefer Array.wrap over #to_miq_a
  • Loading branch information
mzazrivec authored Jul 20, 2020
2 parents 6cced6c + 20210c1 commit 059ed12
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller/filter/expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -445,14 +445,14 @@ def update_from_exp_tree(exp)
end

if val1 && [:datetime, :date].include?(val1[:type]) # Change datetime and date field values into arrays while editing
self.exp_value = exp_value.to_miq_a # Turn date/time values into an array
self.exp_value = Array.wrap(exp_value) # Turn date/time values into an array
val1[:date_format] = exp_value.to_s.first.include?('/') ? 's' : 'r'
if key == EXP_FROM && val1[:date_format] == 'r'
val1[:through_choices] = Expression.through_choices(exp_value[0])
end
end
if val2 && [:datetime, :date].include?(val2[:type])
self.exp_cvalue = exp_cvalue.to_miq_a # Turn date/time cvalues into an array
self.exp_cvalue = Array.wrap(exp_cvalue) # Turn date/time cvalues into an array
val2[:date_format] = exp_cvalue.first.include?('/') ? 's' : 'r'
if ckey == EXP_FROM && val2[:date_format] == 'r'
val2[:through_choices] = Expression.through_choices(exp_cvalue[0])
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/ops_controller/settings/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ def settings_set_form_vars_authentication
@sb[:form_vars] = {}
@sb[:form_vars][:session_timeout_hours] = @edit[:current][:session][:timeout] / 3600
@sb[:form_vars][:session_timeout_mins] = (@edit[:current][:session][:timeout] % 3600) / 60
@edit[:current][:authentication][:ldaphost] = @edit[:current][:authentication][:ldaphost].to_miq_a
@edit[:current][:authentication][:ldaphost] = Array.wrap(@edit[:current][:authentication][:ldaphost])
@edit[:current][:authentication][:user_proxies] ||= [{}]
@edit[:current][:authentication][:follow_referrals] ||= false
@edit[:current][:authentication][:sso_enabled] ||= false
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/report_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def report_selection_menus
@sub_folders ||= []
next unless r[0] == @edit[:new][:filter]
r[1].each do |subfolder, reps|
subfolder.to_miq_a.each do |s|
Array.wrap(subfolder).each do |s|
@sub_folders.push(s)
end
@reps ||= [] if @edit[:new][:subfilter]
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/report_controller/menus.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def menu_field_changed
@edit[:tree_arr].each do |el|
old_folder = @edit[:tree_hash].key(el)
@edit[:temp_arr].each do |arr|
arr = arr.to_miq_a
arr = Array.wrap(arr)
temp = []
if session[:node_selected].split('__')[1] == "Report Menus for #{session[:role_choice]}"
if arr[0] == old_folder
Expand Down
2 changes: 1 addition & 1 deletion app/views/miq_request/_prov_field.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
= render :partial => "miq_request/prov_configured_system_grid", :locals => {:field_id => field_id}
- elsif field == :attached_ds
-# Description is in the second, last, array element
= options[:attached_ds_names].to_miq_a.join(",")
= Array.wrap(options[:attached_ds_names]).join(",")
- elsif options[field]
-# Description is in the second, last, array element
= options[field].last
Expand Down

0 comments on commit 059ed12

Please sign in to comment.