【发布时间】:2018-10-21 14:07:42
【问题描述】:
我的情况是,某些具有font_user 角色的用户可以使用字体,而其他用户则不能。
在ckeditor/config.js 中,我无法从 Rails 获取任何变量。我如何做到这一点?
我尝试过这样的事情:
- 将
config.js修改为config.js.erb。 -
添加以下代码。
<% current_user.has_role?(font_user) %> XXXXX <% else %> XXXX <% end %>我在
application_controller.rb中添加了以下方法:helper_method :current_user但似乎
config.js.erb无法获取current_user变量。
【问题讨论】:
-
请看link