lib/query.rb
lib/warehouse/query.rb
lib/warehouse/table_report_query.rb
in query.rb I had:
class Query < ActiveRecord::Base
some_code_here
endin lib/warehouse/query.rb I had:
module Warehouse
class Query
some_code_here
endend
in lib/warehouse/table_report_query.rb I had:
module Warehouse
class TableReportQuery < Query
some_code_here
endend
So, in the controller, when I did:
table_query = Warehouse::TableReportQuery.new()
You would think that TableReportQuery would inherit from Warehouse::Query. WRONG! It was inheriting from the first Query and throwing the classic activerecord "method not found" error.
So what's the solution. Well, I give credit to this blog article about Ruby Namespace Conflicts for inspiring my solution. I changed lib/warehouse/table_report_query.rb to be:
class Warehouse::TableReportQuery < Warehouse::Query
some_code_here
endand it worked! Is that ruby Voodoo or what?
0 comments:
Post a Comment