Browse files

don't do anything if message doesn't match

  • Loading branch information...
1 parent 5281067 commit 8224b007f7d110252d4eb37576260df168633658 @langalex committed Dec 10, 2010
Showing with 2 additions and 2 deletions.
  1. +1 −1 rails/reload_classes.rb
  2. +1 −1 spec/rails_spec.rb
View
2 rails/reload_classes.rb
@@ -7,7 +7,7 @@ def with_class_reloading(&block)
begin
yield
rescue ArgumentError => e
- if(name = e.message.scan(/(can't find const|undefined class\/module) ([\w\:]+)/).first[1])
+ if(name = e.message.scan(/(can't find const|undefined class\/module) ([\w\:]+)/).try(:first).try(:[], 1))
eval name.gsub(/\:+$/, '')
retry
else
View
2 spec/rails_spec.rb
@@ -32,7 +32,7 @@ class WithUnloadedEmbedded
CouchPotato.couchrest_database.save_doc(JSON.create_id => 'Autoloader::Uninitialized', '_id' => '1')
CouchPotato.database.load('1').class.name.should == 'Autoloader::Uninitialized'
end
-
+
it "should load nested models" do
CouchPotato.couchrest_database.save_doc(JSON.create_id => 'Autoloader::Nested::Nested2', '_id' => '1')
CouchPotato.database.load('1').class.name.should == 'Autoloader::Nested::Nested2'

0 comments on commit 8224b00

Please sign in to comment.