-
-
Save Austio/85c4315f5baef2ee73d0 to your computer and use it in GitHub Desktop.
Error occuring when using active record enum inside of a nested active record class.
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
From: /../gems/activerecord-4.1.11/lib/active_record/attribute_methods.rb @ line 129 ActiveRecord::AttributeMethods::ClassMethods#method_defined_within?: | |
128: def method_defined_within?(name, klass, superklass = klass.superclass) # :nodoc: | |
=> 129: if klass.method_defined?(name) || klass.private_method_defined?(name) | |
130: if superklass.method_defined?(name) || superklass.private_method_defined?(name) | |
131: klass.instance_method(name).owner != superklass.instance_method(name).owner | |
132: else | |
133: true | |
134: end | |
135: else | |
136: false | |
137: end | |
138: end | |
[13] pry(::Network::Contact)> klass.method_defined?(name) | |
=> true | |
[14] pry(::Network::Contact)> name | |
=> "informed_consent_request_state=" | |
[15] pry(::Network::Contact)> klass | |
=> #<Module:0x0000000c34a7b8> | |
[16] pry(::Network::Contact)> klass.methods.grep(/informed_consent_request/) | |
=> [] |
I see, I guess/recall its due to require
. What if you use load
instead?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error raising for enum because it detects a method being defined (informed_consent_request_state=) on klass that does not exist.