Skip to content

Commit

Permalink
Merge branch 'master' into rails3
Browse files Browse the repository at this point in the history
Conflicts:
	HISTORY
	spec/thinking_sphinx/search_spec.rb
  • Loading branch information
pat committed Oct 23, 2011
2 parents 1c0002e + 610074f commit 45b28f6
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 264 deletions.
3 changes: 3 additions & 0 deletions 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).

Expand Down
1 change: 1 addition & 0 deletions README.textile
Expand Up @@ -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
2 changes: 1 addition & 1 deletion contribute.rb
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions lib/thinking_sphinx/context.rb
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions spec/thinking_sphinx/context_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 45b28f6

Please sign in to comment.