# Thinking sphinx search error

**URL:** <https://www.ruby-forum.com/t/thinking-sphinx-search-error/171027>\
**Category:** Rails\
**Created:** [June 25, 2009, 1:07pm UTC](https://www.ruby-forum.com/t/thinking-sphinx-search-error/171027 "2009-06-25T13:07:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [June 25, 2009, 1:07pm UTC](https://www.ruby-forum.com/t/thinking-sphinx-search-error/171027/1 "2009-06-25T13:07:32Z")

</div>

Hello All, I wanted to implement sphinx search. I have following models.  
Blog # post model has column “channel\_feature\_id” has\_many :posts,  
:foreign\_key =\> “channel\_feature\_id” ------ Post # Indexes for thinking  
sphinx define\_index do indexes title indexes abstract indexes body  
#indexes  
comments.body, :as =\> :comment\_content # OPTIONAL: keeps search index  
uptodate # First, add a boolean column to your model, named ‘delta’, and  
have it default to true. # Then uncomment following line. #set\_property  
:delta =\> true end belongs\_to :blog has\_many :comments # GET published  
posts  
named\_scope :published, :conditions =\> [‘published = ?’, true] ------  
Comment belongs\_to :post ------ In my search action i have  
blog.posts.published.search ( params[:search] ) i dont know what is  
going  
wrong with me. i am getting following error Missing Attribute for  
Foreign  
Key channel\_feature\_id

here is full trace…

vendor/plugins/thinking-sphinx/lib/thinking\_sphinx/active\_record/has\_many\_association.rb:18:in  
`search' /home/sandip/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/named_scope.rb:158:in `send’  
/home/sandip/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active\_record/named\_scope.rb:158:in  
`method_missing' /home/sandip/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/base.rb:1857:in `with\_scope’  
/home/sandip/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active\_record/associations/association\_proxy.rb:164:in  
`send' /home/sandip/.gem/ruby/1.8/gems/activerecord-2.1.2/lib/active_record/associations/association_proxy.rb:164:in `with\_scope’  
( **DELEGATION** ):2:in ` __send__' ( __DELEGATION__ ):2:in `with\_scope’  
app/controllers/blogs\_controller.rb:36:in `search’

Thanks, Sandip

–  
Ruby on Rails Developer

> **[Blogs - Neuigkeiten - Artikel - Webseiten - Medien](https://www.sosblog.com/)**
>
> Auf SOSblog geht es um aktuelle Blogs, Neuigkeiten, Artikel, Webseiten und Medien. Wir bringen interessante neue Webseiten aus den Tiefen des Webs.

> **[Judul Situs](https://funonrails.wordpress.com)**
>
> “Cinta tidak mengenal batas. Cinta mampu melewati rintangan, melompati pagar, menembus dinding untuk mencapai tujuannya dengan penuh harapan.” — Maya Angelou

> **[Josh Software | Custom Software Development Services & Solutions](https://joshsoftware.com/)**
>
> JoshSoftware offers custom software development Services & Solution that provides enterprise, software development services for web & mobile.
