Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

Restful Authentication - Check User admin status

Uses h_a_b_t_m relationship to Tier table (via tiers_users join table) to return an array of access groups this user is a member of.

def is_admin? #TODO: make into an accessor?
        return false unless self.tiers
        tier_names = self.tiers.collect {|t| t.name}
        return tier_names.include? "admin"
end
« Newer Snippets
Older Snippets »
1 total  XML / RSS feed