Details
-
Bug
-
Status: Backlog
-
Major - P3
-
Resolution: Unresolved
-
7.0.0
-
None
-
Dev env : ArchLinux
Prod env : Ubuntu 18.04.3
Description
Hello,
When acessing the field `format` via `send` or `_send_` on an instance from a relation, then it seems to call `Kernel#format` (causing an ArgumentError) and not the field `format` read method.
It doesn't happen if the instance if from a `find` or `where`, only if gotten via a relation.
Here come an quick example :
class Test1 |
include Mongoid::Document has_one :test2, class_name: "Test2" |
end
|
|
class Test2 |
include Mongoid::Document belongs_to :test1, class_name: "Test1" field :format, type: Symbol |
end
|
|
t1=Test1.create
|
t2=Test2.create(test1: t1, format: :html)
|
t2.format # => :html
|
t2.send(:format) # => :html
|
|
t1.reload
|
t1.test2.format # => :html
|
t1.test2.send(:format)
|
# =>
|
# ArgumentError: too few arguments
|
# from (pry):18:in `format' |
|
Â
Attachments
Issue Links
- is related to
-
MONGOID-5009 Belongs to relationship makes all target association methods effectively public
-
- Backlog
-
- links to