Sha256: f5d43ad2b2a365339f3aafd26591577f919fe456ab2ac3aff02ab1b500c3dfe3

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

#
# Test model
class User < ActiveRecord::Base
  symbolize :other
  symbolize :language, :in => [:pt, :en]
  symbolize :sex, :in => [true, false], :scopes => true
  symbolize :status , :in => [:active, :inactive], :i18n => false, :capitalize => true, :scopes => true, :methods => true
  symbolize :so, :allow_blank => true, :in => {
    :linux => 'Linux',
    :mac   => 'Mac OS X',
    :win   => 'Videogame'
  }, :scopes => true
  symbolize :gui, :allow_blank => true, :in => [:cocoa, :qt, :gtk], :i18n => false
  symbolize :karma, :in => %w{ good bad ugly}, :methods => true, :i18n => false, :allow_nil => true
  symbolize :cool, :in => [true, false], :scopes => true

  has_many :extras, :dependent => :destroy, :class_name => "UserExtra"
  has_many :access, :dependent => :destroy, :class_name => "UserAccess"
end

class UserSkill < ActiveRecord::Base
  symbolize :kind, :in => [:agility, :magic]
end

class UserExtra < ActiveRecord::Base
  symbolize :key, :in => [:one, :another]
end

class Permission < ActiveRecord::Base
  validates_presence_of :name
  symbolize :kind, :in => [:temp, :perm], :default => :perm
  symbolize :lvl, :in => (1..9).to_a, :i18n => false#, :default => 1
end

# Make with_scope public-usable for testing
#if ActiveRecord::VERSION::MAJOR < 3
class << ActiveRecord::Base
  public :with_scope
end
#end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
symbolize-4.1.0 spec/support/ar_models.rb
symbolize-4.0.4 spec/support/ar_models.rb