Sha256: 429be8b8a0efdf17fdac57fd6b9c4bdcad117dfe548674da2262a87af1c062f1

Contents?: true

Size: 313 Bytes

Versions: 15

Compression:

Stored size: 313 Bytes

Contents

class Role < ActiveRecord::Base

  has_and_belongs_to_many :users

  before_validation :camelize_title
  validates_uniqueness_of :title

  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

15 entries across 15 versions & 1 rubygems

Version Path
refinerycms-0.9.7.15 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.14 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.13 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.11 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.10 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.9 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.8 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.7 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.6 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.5 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.4 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.3 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.2 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7.1 vendor/plugins/authentication/app/models/role.rb
refinerycms-0.9.7 vendor/plugins/authentication/app/models/role.rb