【问题标题】:Cancan on a no model controller无模型控制器上的 Cancan
【发布时间】:2014-05-19 16:59:33
【问题描述】:

我有一个带有配置部分的页面,一些用户可以在其中编辑站点的元素和变量。 我想控制对页面的访问,但因为它不是模型,我不知道该怎么做。

我的控制器

class ConfigurationController < ApplicationController
  def index
  end
end

我的菜单

<% if can?(:read, Configuration) # not sure of that  %> 
    <li><%= link_to t('texts.configuration.title'), configuration_index_path %></li>
<% end %>

这段代码有错误:

uninitialized constant ActionView::CompiledTemplates::Configuration

我实际上不确定这个错误是什么意思。 这样做的正确方法是什么?

谢谢。

【问题讨论】:

    标签: ruby-on-rails cancan


    【解决方案1】:

    这可以在 Github 上关注这篇文章,它描述了您的问题以及如何解决它:

    https://github.com/ryanb/cancan/issues/22

    还有这个:

    CanCan and controllers without models

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-18
      • 2013-01-28
      • 1970-01-01
      相关资源
      最近更新 更多