I am working on a system where a user belongs to an organisation and
each organisation has movies associated with it such that:

class Organisation < ActiveRecord::Base
 has_many  :movies
 has_many  :users
end

class User < ActiveRecord::Base
  belongs_to :organisation
end

class Movie < ActiveRecord::Base
  belongs_to  :organisation

  define_index do
    indexes title

    #has organisation_id, :as => :direct_organisation_id
    has organisation_id
  end
end


Currently my index view shows all the movies of the organisation the
logged in user belongs to:

@movies = current_user.organisation.movies

I am trying to search with the same restriction:

@movies = current_user.organisation.movies.search params[:query]

but I get the error:

Missing Attribute for Foreign Key organisation_id.

I have tried the solution suggestions on stackoverflow but they did
not work.

Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to