This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
barleysodas/app/models/permission.rb

19 lines
405 B
Ruby

##
# Models the ability to perform an action in the system.
#
class Permission < ActiveRecord::Base
has_and_belongs_to_many :roles
validates_presence_of :controller, :action
def to_s # :nodoc:
"#{controller} :: #{action}"
end
##
# Helper to find the necessary models for a form edit.
#
def self.find_for_form
self.find(:all, :order => "controller ASC, action ASC")
end
end