Skip to content

Instantly share code, notes, and snippets.

@tubbo

tubbo/error.txt Secret

Created July 23, 2020 23:09
Show Gist options
  • Save tubbo/7fdcc410c2024371733e6a8b44a9a718 to your computer and use it in GitHub Desktop.
Save tubbo/7fdcc410c2024371733e6a8b44a9a718 to your computer and use it in GitHub Desktop.
block in <module:ItemWithCustomAttributes>': undefined method `field' for #<Module:0x00007fd40bac0198> (NoMethodError)
class Item
include Mongoid::Document
field :foo, type: String
end
module ItemWithCustomAttributes
refine Item do
field :bar, type: String
end
end
class Test < ActiveSupport::TestCase
using ItemWithCustomAttributes # blows up right here attempting to use the refinement
def test_additional_validation
Item.new(foo: 'foo', bar: 'bar') # this is what i want to do
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment