Don't use root in to_json calls

This commit is contained in:
Eric Schultz 2019-11-27 14:04:19 -06:00 committed by Eric Schultz
parent ba14d11086
commit e58571524b

View file

@ -5,11 +5,11 @@ var app = {
, ip: "<%= request.remote_ip %>" , ip: "<%= request.remote_ip %>"
, current_user: <%= current_user ? current_user.id : 'undefined' %> , current_user: <%= current_user ? current_user.id : 'undefined' %>
, current_admin: <%= !!(current_user && current_role?(:super_admin)) %> , current_admin: <%= !!(current_user && current_role?(:super_admin)) %>
, nonprofit: <%= @nonprofit ? raw(@nonprofit.to_json) : 'undefined' %> , nonprofit: <%= @nonprofit ? raw(@nonprofit.to_json(root:false)) : 'undefined' %>
, nonprofit_id : <%= @nonprofit ? @nonprofit.id : 'undefined' %> , nonprofit_id : <%= @nonprofit ? @nonprofit.id : 'undefined' %>
, user: <%= current_user ? raw(current_user.to_json) : 'undefined' %> , user: <%= current_user ? raw(current_user.to_json(root:false)) : 'undefined' %>
, user_id: <%= current_user ? current_user.id : 'undefined' %> , user_id: <%= current_user ? current_user.id : 'undefined' %>
, profile: <%= current_user ? raw(current_user.profile.to_json) : 'undefined' %> , profile: <%= current_user ? raw(current_user.profile.to_json(root:false)) : 'undefined' %>
, profile_id: <%= current_user ? current_user.profile.id : 'undefined' %> , profile_id: <%= current_user ? current_user.profile.id : 'undefined' %>
, asset_path: "<%= Rails.application.config.assets.prefix %>" , asset_path: "<%= Rails.application.config.assets.prefix %>"
, host_with_port: "//<%= request.host_with_port %>" , host_with_port: "//<%= request.host_with_port %>"