if current_user
scope = scope.without_nodes(current_user.block_node_ids) if without_nodes
scope = scope.without_users(current_user.block_user_ids)
end
用 def current_user 在代码里能搜到 3 个,但看起来都不像上面那个 current_user 的定义。
@ken ListActions 没有继承或 include 相关的 class 或 module,用 vs code 的 ruby lsp 扩展也找不到 current_user 的定义
帮你问了,应该就是 devise 里定义的
(byebug) method(:current_user).source_location
["/path_to/homeland/app/controllers/application_controller/deviseable.rb", 34]
@ken @greatghoul 多谢。topics_controller.rb 里也有 current_user,是 include Deviseable 获取的方法。 但 list_actions.rb 没看到继承和 include current_user 方法。
list_actions.rb 是个 module,被 include 到 topic_controller.rb 里面调用,调用环境是 topic_contorller。