Class: Role::PermissionsAttributeCoder
- Inherits:
-
Object
- Object
- Role::PermissionsAttributeCoder
- Defined in:
- app/models/role.rb
Overview
Custom coder for the permissions attribute that should be an array of symbols. Rails 3 uses Psych which can be unbelievably slow on some platforms (eg. mingw32).
Class Method Summary collapse
Class Method Details
.dump(value) ⇒ Object
31 32 33 |
# File 'app/models/role.rb', line 31 def self.dump(value) YAML.dump(value) end |
.load(str) ⇒ Object
27 28 29 |
# File 'app/models/role.rb', line 27 def self.load(str) str.to_s.scan(/:([a-z0-9_]+)/).flatten.map(&:to_sym) end |