Searching has_many relation in solr

My app has two models Genre and Movie. I want to search movies by Movie Title and Genre Name. The association between these two models is a "has many - belongs to" relationship and not a "has one"[1]

This is what my Movie model looks like:
class Movie < ActiveRecord::Base
belongs_to :genre
  searchable do
    text :title
    text :genre do
       category.name
    end
  end
end
[1] - My previous post on the "has many" association

Related Posts

No comments :

Post a Comment