-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MONGOID-5336 User-defined symbol field types - squashed commits
- Loading branch information
1 parent
604a407
commit a8c2217
Showing
14 changed files
with
601 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
module Mongoid | ||
module Errors | ||
|
||
# This error is raised when trying to define a field type mapping with | ||
# invalid argument types. | ||
class InvalidFieldTypeDefinition < MongoidError | ||
|
||
# Create the new error. | ||
# | ||
# @example Instantiate the error. | ||
# InvalidFieldTypeDefinition.new('number', 123) | ||
# | ||
# @param [ Object ] field_type The object which is expected to a be Symbol or String. | ||
# @param [ Object ] klass The object which is expected to be a Class or Module. | ||
def initialize(field_type, klass) | ||
type_inspection = field_type.try(:inspect) || field_type.class.inspect | ||
klass_inspection = klass.try(:inspect) || klass.class.inspect | ||
super( | ||
compose_message('invalid_field_type_definition', | ||
type_inspection: type_inspection, klass_inspection: klass_inspection) | ||
) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.