Class: Role::PermissionsAttributeCoder

Inherits:
Object
  • Object
show all
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



29
30
31
# File 'app/models/role.rb', line 29

def self.dump(value)
  YAML.dump(value)
end

.load(str) ⇒ Object



25
26
27
# File 'app/models/role.rb', line 25

def self.load(str)
  str.to_s.scan(/:([a-z0-9_]+)/).flatten.map(&:to_sym)
end