Closed PabloMD closed 7 years ago
Thanks for the info. I will take a look in the following days!
@PabloMD I didn't find any issue, but I am adding tests not to feat/tests branch just to be sure.
@vasilakisfil, I do not have time to investigate it further right now. Here's what I get on rails console just in case you are curious:-)
2.3.1 :001 > Payment.dotpay
NoMethodError: undefined method `where' for #<Module:0x000000064c8848>
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/activerecord-5.0.0.1/lib/active_record/enum.rb:193:in `block (4 levels) in enum'
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/active_hash_relation-1.1.0/lib/active_record/scope_names.rb:22:in `block (2 levels) in scope'
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/activerecord-5.0.0.1/lib/active_record/relation.rb:351:in `scoping'
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/active_hash_relation-1.1.0/lib/active_record/scope_names.rb:22:in `block in scope'
from (irb):1
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:9:in `require'
from bin/rails:9:in `<main>'
@PabloMD I added some test cases with enums, I don't see any conflict anywhere. Are you sure it comes from ActiveHashRelation ?
@vasilakisfil, hi the previous reply is from my company account:-), and it looks that the problem lies in resolving scope by ActiveHashRelation.
In your added test case you actualy query DB by column and its value which works, I have tested it too (Payment.where(payment_type: 1)
), but when you use Payment.dotpay
it should translate it to same query ('Payment.where(payment_type: 1)').
... from /home/pablo/.rvm/gems/ruby-2.3.1@glakso5/gems/active_hash_relation-1.1.0/lib/active_record/scope_names.rb:22:in `block (2 levels) in scope'
Thanks for reporting. I have fixed it on master. Some notes:
Closing for now, feel free to reopen.
After gem install I start receiving error:
code example: Model
then:
Payment.dotpay
raises the exception above