-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Tests
Mongoid has two ways to define field aliases:
class Band include Mongoid::Document # case 1 field :n, type: String alias_attribute :name, :n # case 2 field :a, as: :age end Band.database_field_name(:name) #=> "n" Band.database_field_name(:age) #=> "a"
Mongoid has several 100s of tests today which cover field alias related behavior. In most tests, only case 2 (:as) is covered. We should review all tests to ensure that both patterns are covered in all cases.