# Undefined method for Polymorphic association using Searchlogic

**URL:** <https://www.ruby-forum.com/t/undefined-method-for-polymorphic-association-using-searchlogic/184340>\
**Category:** Rails\
**Created:** [March 1, 2010, 9:18am UTC](https://www.ruby-forum.com/t/undefined-method-for-polymorphic-association-using-searchlogic/184340 "2010-03-01T09:18:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmht81](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/57b2e6/32.png) [@dmht81](https://www.ruby-forum.com/u/dmht81)\
**Post date:** [March 1, 2010, 9:18am UTC](https://www.ruby-forum.com/t/undefined-method-for-polymorphic-association-using-searchlogic/184340/1 "2010-03-01T09:18:17Z")

</div>

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  
> > =\> 39649
> 
> > TimesheetEntry.timesheet\_enterable\_id\_equals(“100”).size  
> > =\> 9
> 
> > Task.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:in `method_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:in `method_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
