I am unable to call a polymorphic scope using the searchlogic plugin
as it keeps on returning ‘undefined method’. I am certain it is only a
problem within my project as I created a test project and I was able
to call a polymorphic scope using the searchlogic plugin.
I am hoping someone can provide a suggestion on how to debug this
issue.
My project consists of several gems, and is using Rails v2.3.4 and the
latest searchlogic repository.
Thanks in advance.
Polymorphic model association
class TimesheetEntry < ActiveRecord::Base
belongs_to :timesheet_enterable, :polymorphic => true
class Task < ActiveRecord::Base
has_many :timesheet_entries, :as => :timesheet_enterable
attr_accessible :project_id
Console results
TimesheetEntry.timesheet_enterable_type_equals(“Task”).size
=> 39649TimesheetEntry.timesheet_enterable_id_equals(“100”).size
=> 9Task.project_id_equals(217).size
=> 16
TimesheetEntry.timesheet_enterable_task_type_project_id_equals(217).entry_type_equals(“project”)
NoMethodError: undefined method
timesheet_enterable_task_type_project_id_equals' for #<Class: 0x36bd660> from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/ searchlogic/named_scopes/conditions.rb:88:in
method_missing’
from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/
searchlogic/named_scopes/association_conditions.rb:19:in
method_missing' from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/ searchlogic/named_scopes/association_ordering.rb:27:in
method_missing’
from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/
searchlogic/named_scopes/ordering.rb:30:inmethod_missing' from /Users/chino/Documents/git/isf001/vendor/plugins/searchlogic/lib/ searchlogic/named_scopes/or_conditions.rb:28:in
method_missing’
from /Users/chino/Documents/git/isf001/vendor/rails/activerecord/lib/
active_record/base.rb:1959:inmethod_missing_without_paginate' from /Users/chino/Documents/git/isf001/vendor/plugins/will_paginate/ lib/will_paginate/finder.rb:170:in
method_missing’
from (irb):16
from :0