Skip to content

Commit

Permalink
Refs #35274 - Fix tests, simplify finder
Browse files Browse the repository at this point in the history
  • Loading branch information
ofedoren committed Jul 28, 2022
1 parent 9196997 commit 8e1c80c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/controllers/concerns/application_shared.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ def find_session_taxonomy(taxonomy, user)
end

def find_selected_columns
instance_variable_set(
'@selected_columns',
Foreman::SelectableColumns::Storage.selected_by(User.current, controller_name)
)
@selected_columns = Foreman::SelectableColumns::Storage.selected_by(User.current, controller_name)
end
end
2 changes: 2 additions & 0 deletions app/controllers/hosts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class HostsController < ApplicationController
before_action :set_host_type, :only => [:update]
before_action :find_multiple, :only => MULTIPLE_ACTIONS
before_action :validate_power_action, :only => :update_multiple_power_state
# index action is already included in ApplicationController
before_action(:only => SEARCHABLE_ACTIONS.without('index')) { find_selected_columns }

helper :hosts, :reports, :interfaces

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/selectable_columns_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def render_selected_column_tds(record)
def attr_from_callbacks(callbacks, subject)
return unless callbacks

callbacks.reduce([]) { |m, (k, v)| m << "#{k}=\"#{instance_exec(subject, &v)}\"" }
callbacks.map { |(k, v)| "#{k}=\"#{instance_exec(subject, &v)}\"" }
.join(' ')
.html_safe
end
Expand Down

0 comments on commit 8e1c80c

Please sign in to comment.