Created
June 16, 2017 14:45
-
-
Save emad-elsaid/1429293e9957551a6c1c8cf24c238146 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
self.roles | |
@roles ||= %w(admin moderator contributor) | |
end | |
end | |
# > User.roles | |
# => ["admin", "moderator", "contributor"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User < ActiveRecord::Base | |
ROLES = %w(admin moderator contributor) | |
end | |
# > User::ROLES | |
# => ["admin", "moderator", "contributor"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment