Sha256: b051b864341cf03bcaa1e18919d03cc4cfddc71bc6588328117ecbcf4a0db215

Contents?: true

Size: 320 Bytes

Versions: 42

Compression:

Stored size: 320 Bytes

Contents

class Role < ActiveRecord::Base

  has_and_belongs_to_many :users

  before_validation :camelize_title
  validates :title, :uniqueness => true

  def camelize_title(role_title = self.title)
    self.title = role_title.to_s.camelize
  end

  def self.[](title)
    find_or_create_by_title(title.to_s.camelize)
  end

end

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
refinerycms-authentication-1.0.11 app/models/role.rb
refinerycms-authentication-1.0.10 app/models/role.rb
refinerycms-authentication-1.0.9 app/models/role.rb
refinerycms-authentication-1.0.8 app/models/role.rb
refinerycms-authentication-1.0.7 app/models/role.rb
refinerycms-authentication-1.0.5 app/models/role.rb
refinerycms-authentication-1.0.4 app/models/role.rb
refinerycms-authentication-1.0.3 app/models/role.rb
refinerycms-authentication-1.0.1 app/models/role.rb
refinerycms-authentication-1.0.0 app/models/role.rb
refinerycms-authentication-0.9.9.22 app/models/role.rb
refinerycms-authentication-0.9.9.21 app/models/role.rb
refinerycms-authentication-0.9.9.20 app/models/role.rb
refinerycms-authentication-0.9.9.19 app/models/role.rb
refinerycms-authentication-0.9.9.18 app/models/role.rb
refinerycms-authentication-0.9.9.17 app/models/role.rb
refinerycms-authentication-0.9.9.16 app/models/role.rb
refinerycms-authentication-0.9.9.15 app/models/role.rb
refinerycms-authentication-0.9.9.14 app/models/role.rb
refinerycms-authentication-0.9.9.13 app/models/role.rb