簡體   English   中英

rails milia current_tenant在控制器中的用法

[英]rails milia current_tenant usage in controllers

我正在使用m子寶石; 我如何在所有視圖中看到current_tenant.name而不將其添加到每個控制器操作中?

有點像在所有模型中都設計了current_user

你可以這樣子做...

class ApplicationController < ActionController::Base
  helper_method :current_tenant

  def current_tenant
   # Your tenant code here
  end
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM