我正在开发一个 Rails 应用程序,我有2 个不同的用户角色:高级和基本。
而不是隐藏基本用户视图中的链接(使用 CanCan 的ai)我想管理两组不同的视图:一个用于高级用户,一个用于基本用户。
目前我正在以这种方式工作:
case current_operator.op_type
when 'basic'
format.html { render :template => "devices/index_basc.html.erb" }
when 'advanced'
format.html # index.html.erb
end
但我不喜欢在每个操作中为基本用户指定模板({ render :template => "devices/index_basc.html.erb" })我认为还有其他方式(我希望更简洁:)
你有什么想法 ?
谢谢你,亚历山德罗