views:

29

answers:

1

I'd like to control the permit method with something like this

class SomethingController < ApplicationController permit :somerole end

where ':somerole' is a field in the database linked to a controller and an action. Something that an user with priviledge can administer and change.

Some Idea?

+2  A: 

this is just for example i have

class Admin::AdminController < ApplicationController
  before_filter :login_required
  before_filter :only_moderator_and_above

  layout 'admin'

  def only_moderator_and_above
    unless current_user.has_admin_access?
      flash[:notice] = CustomMessages.admin_permission_alert
      redirect_to '/'
    end
  end
end
Kuya