Skip to content
Browse files

Merge branch 'master' into rails3

Conflicts:
	HISTORY
	spec/thinking_sphinx/search_spec.rb
  • Loading branch information...
2 parents 1c0002e + 610074f commit 45b28f6cd8cd0d250a9c16c38bed798eb770376d @pat committed Oct 23, 2011
Showing with 260 additions and 264 deletions.
  1. +3 −0 HISTORY
  2. +1 −0 README.textile
  3. +1 −1 contribute.rb
  4. +3 −0 lib/thinking_sphinx/context.rb
  5. +2 −3 spec/thinking_sphinx/context_spec.rb
  6. +250 −260 spec/thinking_sphinx/search_spec.rb
View
3 HISTORY
@@ -1,3 +1,6 @@
+Edge:
+* Fixing STI model handling during context index loading (Kenn Ejima).
+
2.0.9 - October 10th 2011
* 1.4.9 changes (fixed invalid gemspec).
View
1 README.textile
@@ -224,3 +224,4 @@ Since I first released this library, there's been quite a few people who have su
* Pete Deffendol
* Eduardo Casanova
* Tony Pitale
+* Kenn Ejima
View
2 contribute.rb
@@ -220,7 +220,7 @@ def mysql_adapter
def connect_to_db
config = YAML.load_file(db_yml)
- config.update(:adapter => mysql_adapter, :database => 'thinking_sphinx')
+ config.update(:adapter => mysql_adapter)
config.symbolize_keys!
ActiveRecord::Base.establish_connection(config)
View
3 lib/thinking_sphinx/context.rb
@@ -62,6 +62,9 @@ def load_models
begin
camelized_model.constantize
+ rescue LoadError
+ # Make sure that STI subclasses in subfolders are loaded.
+ model_name.gsub!(/.*[\/\\]/, '').nil? ? next : retry
rescue Exception => err
STDERR.puts "Warning: Error loading #{file}:"
STDERR.puts err.message
View
5 spec/thinking_sphinx/context_spec.rb
@@ -41,10 +41,9 @@
}.should_not raise_error
end
- it "should report load errors but not raise them" do
+ it "should retry if the first load fails and contains a directory" do
+ model_name_lower.should_receive(:gsub!).twice.and_return(true, nil)
class_name.stub(:constantize).and_raise(LoadError)
- STDERR.stub!(:puts => '')
- STDERR.should_receive(:puts).with('Warning: Error loading a.rb:')
lambda {
ts_context.prepare
View
510 spec/thinking_sphinx/search_spec.rb
250 additions, 260 deletions not shown because the diff is too large. Please use a local Git client to view these changes.

0 comments on commit 45b28f6

Please sign in to comment.
Something went wrong with that request. Please try again.