Skip to content

Commit

Permalink
Merge pull request #12475 from himdel/nil-to_s-or-new
Browse files Browse the repository at this point in the history
Convert (foo.to_s || "new") to (foo || "new").to_s
(cherry picked from commit fa4d6c9)

https://bugzilla.redhat.com/show_bug.cgi?id=1411362
  • Loading branch information
jrafanie authored and simaishi committed Jan 9, 2017
1 parent 166c703 commit eff8087
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller/buttons.rb
Expand Up @@ -116,7 +116,7 @@ def automate_button_field_changed
page.replace("ab_form", :partial => "shared/buttons/ab_form")
end
if params[:visibility_typ]
page.replace("form_role_visibility", :partial => "layouts/role_visibility", :locals => {:rec_id => (@custom_button.id.to_s || "new"), :action => "automate_button_field_changed"})
page.replace("form_role_visibility", :partial => "layouts/role_visibility", :locals => {:rec_id => (@custom_button.id || "new").to_s, :action => "automate_button_field_changed"})
end
unless params[:target_class]
@changed = (@edit[:new] != @edit[:current])
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/miq_ae_customization_controller/dialogs.rb
Expand Up @@ -517,7 +517,7 @@ def field_value_accept
page << javascript_for_miq_button_visibility(changed)

# replace select tag of default values
url = url_for(:action => 'dialog_form_field_changed', :id => (@record.id.to_s || "new"))
url = url_for(:action => 'dialog_form_field_changed', :id => (@record.id || "new").to_s)
none = [['<None>', nil]]
values = key[:values].empty? ? none : none + key[:values].collect(&:reverse)
selected = @edit[:field_default_value]
Expand Down Expand Up @@ -557,7 +557,7 @@ def field_value_delete
page << javascript_for_miq_button_visibility(changed)

# replace select tag of default values
url = url_for(:action => 'dialog_form_field_changed', :id => (@record.id.to_s || "new"))
url = url_for(:action => 'dialog_form_field_changed', :id => (@record.id || "new").to_s)
none = [['<None>', nil]]
values = key[:values].empty? ? none : none + key[:values].collect(&:reverse)
selected = @edit[:field_default_value]
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/ops_controller.rb
Expand Up @@ -167,12 +167,12 @@ def change_tab(new_tab_id = nil)
@scan = @edit[:scan]
case params[:tab].split("_")[0]
when "new"
redirect_to(:action => "ap_new", :tab => params[:tab], :id => (@scan.id.to_s || "new"))
redirect_to(:action => "ap_new", :tab => params[:tab], :id => (@scan.id || "new").to_s)
when "edit"
redirect_to(:action => "ap_edit", :tab => params[:tab], :id => (@scan.id.to_s || "new"))
redirect_to(:action => "ap_edit", :tab => params[:tab], :id => (@scan.id || "new").to_s)
else
@sb[:miq_tab] = "new#{params[:tab]}"
redirect_to(:action => "ap_edit", :tab => "edit#{params[:tab]}", :id => (@scan.id.to_s || "new"))
redirect_to(:action => "ap_edit", :tab => "edit#{params[:tab]}", :id => (@scan.id || "new").to_s)
end
else
@sb[:active_tab] = params[:tab_id] || new_tab_id
Expand Down

0 comments on commit eff8087

Please sign in to comment.