controllers: set @current_item globally in respond_with.

This commit is contained in:
evazion
2020-01-29 21:30:43 -06:00
parent 6b066f2cab
commit c7185724d5
20 changed files with 25 additions and 25 deletions

View File

@@ -214,10 +214,10 @@ module ApplicationHelper
render "table_builder/table", table: table
end
def body_attributes(user = CurrentUser.user, current_item = nil)
def body_attributes(user, params, current_item = nil)
current_user_data_attributes = data_attributes_for(user, "current-user", current_user_attributes)
if current_item.present?
if params[:action] == "show" && current_item.present?
model_name = current_item.model_name.singular.dasherize
model_attributes = current_item.html_data_attributes
current_item_data_attributes = data_attributes_for(current_item, model_name, model_attributes)