Just starting working with Rails QueryObjects. I would like to group them in modules and submodules, but it doesn't work.
With a simple QueryObject test, it works:
class CountriesQuery
def initialize()
end
def call()
Country.where("id=1")
end
end
In Controller:
@countries = CountriesQuery.new.call()
Now, I tried this:
module Shared
module Countries
class CountriesQuery
def initialize()
end
def call()
Country.where("id=1")
end
end
end
end
My folder structure is queries > shared > countries > countries_query.rb
Controller:
@countries = Shared::Countries::CountriesQuery.new.call()
And the error is:
undefined method `where' for Shared::Country:Module
But Country is a model, nothing to do with a module...
So, how to use namespace/modules AND QueryObjects together ?