Skip to content

Instantly share code, notes, and snippets.

@akaHeimdall
Created August 3, 2009 17:00
Show Gist options
  • Save akaHeimdall/160692 to your computer and use it in GitHub Desktop.
Save akaHeimdall/160692 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
has_and_belongs_to_many :roles
def role_symbols
(self.roles || []).map {|r| r.name.to_sym}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment