0

I have a page with a configuration part where some users can edit element and variable of the site. I want to cancan controle the access to the page but as it's not a model, and I'm not sure how to do.

My controller

class ConfigurationController < ApplicationController
  def index
  end
end

My menu

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

I have a error with this code :

uninitialized constant ActionView::CompiledTemplates::Configuration

I'm actualy not sure of what mean this error. What will be the correct way to do that?

Thanks.

Yoann Augen
  • 1,966
  • 3
  • 21
  • 39

1 Answers1

1

This is possible follow this post on Github it describe your problem and how to solve it:

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

and also this:

CanCan and controllers without models

Community
  • 1
  • 1
matanco
  • 2,096
  • 1
  • 13
  • 20