File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ def authenticate_request!
3434 Current . user_id = @current_user . id
3535 Current . user_role = @current_user . role
3636
37+ # Debug log in production to verify Current is being set
38+ Rails . logger . info ( "[AUTH] Set Current.organization_id=#{ Current . organization_id } for user #{ @current_user . email } " )
39+
3740 # Update last login time (uses update_column which skips callbacks/audit logs)
3841 @current_user . update_last_login! if should_update_last_login?
3942 rescue Authentication ::Services ::JwtService ::AuthenticationError => e
Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ module OrganizationScoped
99 included do
1010 # Aplicar default_scope apenas se houver uma organização no contexto
1111 default_scope lambda {
12- if Current . organization_id . present?
13- where ( organization_id : Current . organization_id )
12+ org_id = Current . organization_id
13+ if org_id . present?
14+ where ( organization_id : org_id )
1415 else
16+ Rails . logger . warn ( "[SCOPE] OrganizationScoped: Current.organization_id is nil for #{ name } " )
1517 all
1618 end
1719 }
You can’t perform that action at this time.
0 commit comments