github.com/trliner/fake_id
class SecretAgentAlias < ActiveRecord :: Base
include FakeId
attr_accessible :document_type_id
fake_ids_for :document_type , {
:drivers_license => 1 ,
:passport => 2
}
end
Generated instance methods¶ ↑
alias = SecretAgentAlias.new(:document_type_id = 1)
alias.document_type
=> :drivers_license
alias.document_type = :passport
alias.document_type
=> :passport
alias.passport?
alias.passport
=> true
alias.drivers_license?
alias.drivers_license
=> false
Generated class methods¶ ↑
SecretAgentAlias.document_types
=> [:drivers_license, :passport]
SecretAgentAlias.document_type_mappings
=> {1=>:drivers_license, 2=>:passport}
SecretAgentAlias.lookup_document_type(1)
=> :drivers_license
SecretAgentAlias.lookup_document_type(:passport)
=> 1
Generated named scopes¶ ↑
SecretAgentAlias .drivers_license
SecretAgentAlias .not_passport
SecretAgentAlias .document_type_is (:drivers_license )
SecretAgentAlias .document_type_is_not (:passport )
SecretAgentAlias .document_type_in (:drivers_license , :passport )
SecretAgentAlias .document_type_not_in (:drivers_license , :passport )