Skip to content

Instantly share code, notes, and snippets.

@ahawkins
Created July 1, 2009 23:12
Show Gist options
  • Save ahawkins/139143 to your computer and use it in GitHub Desktop.
Save ahawkins/139143 to your computer and use it in GitHub Desktop.
module KeepUp
module Permissions
module RoleExtension
def self.included(klass)
klass.class_eval do
include KeepUp::Permissions::CommonMethods
include KeepUp::Permissions::Language
has_and_belongs_to_many :users, :join_table => :user_roles
has_one :permission, :as => :authorizable
alias :has_permission? :has_local_permission?
alias :can? :has_local_permission?
after_create :create_permission
accepts_nested_attributes_for :permission
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment