Rails 3 Support

27 views
Skip to first unread message

Pat Allan

unread,
Jun 20, 2010, 10:29:03 AM6/20/10
to Thinking Sphinx
Hi everyone

Just a quick note to say that I've released a branch that supports Rails 3. You'll need to clone, then run 'rake build' to generate it (and will need RSpec 2.0 beta installed). It needs some cleaning up, but I think it should work in standard situations, except for polymorphic associations in fields and attributes. That'll come later. Thank you to those who gave me a fantastic headstart with their patches.

http://github.com/freelancing-god/thinking-sphinx/tree/rails3

I've not yet tested the delta gems or raspell gem... patience :)

Also, it's worth noting the following:

* This branch supports only Rails 3, not Rails 2 or older.
* So, going forward, TS 2.x will support Rails 3.x
* TS 1.x will continue to support Rails 2.x
* TS 1.4.0 and onwards will *not* support Rails 1.x

Once I clean this all up I will release TS 2 as a pre-release gem, but for now, grabbing the source is the best way to go.

Oh, and remove the "require 'thinking_sphinx/tasks'" from your Rakefile - Rails 3 now has hooks for gems to provide details about rake tasks, so it now happens automatically - just like as if you installed it as a plugin (or in Merb, which has had these hooks for a long time).

Please, if you have any issues, let me know :)

Cheers

--
Pat
e: p...@freelancing-gods.com || m: +614 1327 3337
w: http://freelancing-gods.com || t: twitter.com/pat
bounce: http://trampolineday.com || skype: patallan

Eric

unread,
Jun 21, 2010, 1:51:13 AM6/21/10
to Thinking Sphinx
Terrific news, very excited to try it out!

--> Eric

Jinzhu

unread,
Jun 21, 2010, 2:00:18 AM6/21/10
to thinkin...@googlegroups.com
wow, nice news.

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




--
Best regards

------------------------
Zhang Jinzhu (Juice)
github.com/jinzhu

Pavel Timofeev

unread,
Jun 23, 2010, 3:40:50 AM6/23/10
to Thinking Sphinx
Does it work for anyone?
I couldn't make it work with Rails 3.

Pat Allan

unread,
Jun 23, 2010, 3:46:16 AM6/23/10
to thinkin...@googlegroups.com
Hi Pavel

How are you installing it? How is it not working?

From what I've heard via other channels, it seems to be working fine for others.

--
Pat

Pavel Timofeev

unread,
Jun 23, 2010, 3:53:58 AM6/23/10
to Thinking Sphinx
Hi Pat,

I've added this line to my Gemfile:
gem 'thinking-sphinx', :git => 'git://github.com/freelancing-god/
thinking-sphinx.git', :branch => 'rails3'

Then I run "bundle install --relock" and get this message:
Using thinking-sphinx (2.0.0.beta1) from git://github.com/freelancing-god/thinking-sphinx.git
(at rails3)
thinking-sphinx at /home/pavel/.bundle/ruby/1.8/bundler/gems/thinking-
sphinx-cfb46fc425097c297748389d3f6f1aed8c93b188-rails3 did not have a
valid gemspec.
This prevents bundler from installing bins or native extensions, but
that may not affect its functionality.
The validation message from Rubygems was:
["lib/thinking_sphinx/rails_additions.rb", "features/thinking_sphinx/
database.yml", "spec/thinking_sphinx/rails_additions_spec.rb"] are not
files

When I run "rake -T sphinx" I don't see sphinx specific tasks.

I'm on Rails 3.0.0.beta4

Thanks.

Pat Allan

unread,
Jun 23, 2010, 4:09:36 AM6/23/10
to thinkin...@googlegroups.com
Ah, my bad... I removed the rails_additions.rb recently, but didn't update the gemspec. I've just pushed a fix - give that a spin, it should be fine now :)

--
Pat

Pavel Timofeev

unread,
Jun 23, 2010, 4:35:09 AM6/23/10
to Thinking Sphinx
Thanks, bundle doesn't show me the warning anymore and I reckon
the gem was installed successfully but I still can't make it work.

There are still no sphinx specific rake tasks and I get messages like
undefined method `define_index' for #<Class:0xb6b57f14>

I went trough the documentation on your web site and added
require 'thinking_sphinx/tasks' to me Rakefile

Now I see the sphinx tasks but when I try to run any I end up getting:
rake aborted!
uninitialized constant ThinkingSphinx

This is the full trace:
rake thinking_sphinx:index --trace
(in /home/pavel/Sites/ct)
** Invoke thinking_sphinx:index (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
** Execute thinking_sphinx:index
rake aborted!
uninitialized constant ThinkingSphinx
/home/pavel/.bundle/ruby/1.8/bundler/gems/thinking-sphinx-
cfb46fc425097c297748389d3f6f1aed8c93b188-5b3a3d393db4a07ceb4683d4a85eab24eb594460/
lib/thinking_sphinx/tasks.rb:66
/usr/lib/ruby/1.8/rake.rb:636:in `call'
/usr/lib/ruby/1.8/rake.rb:636:in `execute'
/usr/lib/ruby/1.8/rake.rb:631:in `each'
/usr/lib/ruby/1.8/rake.rb:631:in `execute'
/usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:583:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2029:in `each'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2023:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2001:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28

Do I do something wrong?

Pat Allan

unread,
Jun 23, 2010, 4:40:11 AM6/23/10
to thinkin...@googlegroups.com
Hi Pavel

You shouldn't need the require statement in the Rakefile - Rails 3 has some rake task hooks for gems, so it's not necessary. That said, you shouldn't be seeing the define_index error either.

You may need to add the following to the gem declaration in your Gemfile - :require => 'thinking_sphinx' - that should get Thinking Sphinx loading correctly.

Cheers

--
Pat

Pavel Timofeev

unread,
Jun 23, 2010, 4:53:31 AM6/23/10
to thinkin...@googlegroups.com
Hi Pat,

It did help me and everything seems to work now!

Thanks for your support and great gem. I can't wait to start using it!

Cheers,
Pavel
--
With best regards,
Pavel

+60172531947
Reply all
Reply to author
Forward
0 new messages