Hi, It would be trulely appreciated if anyone can give me some advise on
this.
I have two related tables titles and authors. Using acts_as_ferret, I
can search by title name. However, when search by author name or ausname
in this case, I only get "sorry, found 0 item".

class Title < ActiveRecord::Base
  acts_as_ferret :additional_fields => [:author_name]
  belongs_to :author

  def author_name
    return author.ausname
  end
-------------------------
class Author < ActiveRecord::Base
  has_many :titles
end
-------------------------
def search
    if params[:q]
      query = params[:q]
      @titles = Title.find_by_contents(query)
      unless @titles.size > 0
     flash.now[:notice_not_found] = "Sorry, found 0 item"
    end
    render :action => 'search_result'
    end
end
-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to