Sha256: e33bfae2a4bfec16e2178c2d1ed6c9bb7ef416a83eb973045fd7c835d0856686

Contents?: true

Size: 219 Bytes

Versions: 4

Compression:

Stored size: 219 Bytes

Contents

class Role < ActiveRecord::Base
  validates_presence_of :name
  validates_uniqueness_of :name
    
  def self.[](name)
    Rails.cache.fetch("/roles/#{name}") { find_by_name(name.to_s) }
  end

  def to_s; name; end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
objectreload-roles-0.1.4 lib/role.rb
objectreload-roles-0.1.2 lib/role.rb
objectreload-roles-0.1.1 lib/role.rb
objectreload-roles-0.1.0 lib/role.rb