예외: Mongoid::Errors::MongoidError

상속:
StandardError
  • 객체
모두 표시
다음에 정의됨:
lib/mongoid/errors/mongoid_error.rb

개요

모든 사용자 지정 오류에 대한 기본 상위 Mongoid 오류입니다. 이는 번역을 위한 기본 키를 처리하고 메시지를 번역하기 위한 편리한 메서드를 제공합니다.

직접 알려진 하위 클래스

AmbiguousRelationship , AttributeNotLoaded , Callback , CreateCollectionFailure , CriteriaArgumentRequired , DeleteRestriction , DocumentNotDestroyed , DocumentNotFound , DropCollectionFailure , EmptyConfigFile , ImmutableAttribute , InMemoryCollationNotSupported , InvalidAroundCallback , InvalidAutoEncryptionConfiguration , InvalidCollection , InvalidConfigFile , InvalidConfigOption , InvalidDependentStrategy , InvalidDiscriminatorKeyTarget , InvalidDotDollarAssignment , InvalidEstimatedCountCriteria , InvalidEstimatedCountScoping , InvalidField , InvalidFieldOption , InvalidFieldType , InvalidFind , InvalidGlobalExecutorConcurrency , InvalidIncludes , InvalidIndex , InvalidOptions , InvalidPath , InvalidPersistenceOption , InvalidQuery , InvalidQueryExecutor , InvalidRelation , InvalidRelationOption , InvalidScope , InvalidSessionNesting , InvalidSetPolymorphicRelation , InvalidStorageOptions , InvalidTime , InvalidTransactionNesting , InverseNotFound , MixedClientConfiguration , Mix edRelations , NestedAttributesMetadataNotFound , NoClientConfig , NoClientDatabase , NoClientHosts , NoClientsConfig , NoDefaultClient , NoEnvironment , NoMapReduceOutput , NoMetadata , NoParent , ReadonlyAttribute , ReadonlyDocument , Rollback , ScopeOverwrite , SessionsNotSupported , TooManyNestedAttributeRecords , TransactionError , TransactionsNotSupported , UnknownAttribute , UnknownModel , UnrecognizedModelAlias , UnrecognizedResolver , UnregisteredClass , UnsavedDocument , UnsupportedJavascript, 유효성 검사

상수 요약 접기

BASE_KEY =
"mongoid.errors.messages"

인스턴스 속성 요약 접기

인스턴스 메서드 요약 접기

인스턴스 속성 세부 정보

#문제객체 (읽기 전용)

속성 문제의 값을 반환합니다.


12
13
14
# 파일 'lib/mongoid/errors/mongoid_error.rb', 줄 12

def 문제
  @problem
end

#해상도객체 (읽기 전용)

속성 확인 값을 반환합니다.


12
13
14
# 파일 'lib/mongoid/errors/mongoid_error.rb', 줄 12

def 해상도
  @solution
end

#요약객체 (읽기 전용)

속성 요약의 값을 반환합니다.


12
13
14
# 파일 'lib/mongoid/errors/mongoid_error.rb', 줄 12

def 요약
  @summary
end

인스턴스 메서드 세부 정보

#Compose_message(key, attributes = {}) ⇒ string

메시지를 작성합니다.

예시:

메시지 만들기

error.compose_message

반환합니다:

  • (string)

    작성된 메시지입니다.

[소스 보기]

22
23
24
25
26
27
28
29
30
31
32
33
34
# 파일 'lib/mongoid/errors/mongoid_error.rb', 줄 22

def Compose_message(, 속성 = {})
  @problem = 번역 문제(, 속성)
  @summary = convert_summary(, 속성)
  @solution = 번역 해상도(, 속성)
  @problem_title = 번역("message_title", {})
  @summary_title = 번역("summary_title", {})
  @solution_title = 번역("해상도_제목 ", {})


  "\n#{@problem_title}:\n  #{@problem&.스트립}"+
  "\n#{@summary_title}:\n  #{@summary&.스트립}"+
  "\n#{@ 해상도_타이틀}:\n  #{@해상도&.스트립}"
end