Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Daren Serra Dias Warburton's Profile

GitHub User: docgecko

Site: http://www.docgecko.com

Comments by Daren Serra Dias Warburton

Avatar

I have the same issue, did you resolve this?

Avatar

I used this and it works also:

ruby
def sort
    params[:faq].each_with_index do |id, index|
        faq = Faq.find(id)
        faq.update_attribute(:position, index) if faq
    end
    render nothing: true
end

In this case, it uses update_attribute instead of update_all...update_all was giving me an error with Mongoid 2

Avatar

How do you think this compares to the terminitor gem...I have been using it to start up my environments.

Avatar

I have this working with Kaminari, what is the problem you are having?

Avatar

Try:

gem "sunspot_matchers"
gem "sunspot-rails-tester"

Avatar

Yeah, thanks Ryan, great cast!

I too switched from Thinking Sphinx over to Sunspot, mainly because at the time I was developing an app needing fulltext search, Heroku did not support TS. Please note that Heroku does support TS now.

Also, I used Sunspot with Mongoid, but this required a monkeypatch to have access to variables such as current_page, total_pages, etc...those used in pagination. Here is a link to the approach I took http://techbot.me/2011/01/full-text-search-in-in-rails-with-sunspot-and-solr/.

And no rake tasks existed with the sunspot_mongoid gem, so I used Aaron Qian's version that can be found on Github, and it works sweet.

Anyway Ryan, I hope you can show us a little more sunspot but used with Mongoid...I'm sure you will have a better solution than the one I have just described!

Avatar

Awesome stuff Ryan! Love the ease of including subdomains in 3.1!