active_record_shards 2.5.6 → 2.5.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -180,14 +180,10 @@ module ActiveRecordShards
180
180
  end
181
181
 
182
182
  def columns_with_default_shard
183
- begin
183
+ if is_sharded? && current_shard_id.nil?
184
+ on_first_shard { columns_without_default_shard }
185
+ else
184
186
  columns_without_default_shard
185
- rescue
186
- if is_sharded? && (shard_name = shard_names.first)
187
- on_shard(shard_name) { columns_without_default_shard }
188
- else
189
- raise
190
- end
191
187
  end
192
188
  end
193
189
 
@@ -136,6 +136,10 @@ class ConnectionSwitchenTest < ActiveSupport::TestCase
136
136
  end
137
137
  end
138
138
 
139
+ before_should "not try the unsharded connection" do
140
+ ActiveRecord::Base.connection.expects(:columns).never
141
+ end
142
+
139
143
  before_should "try the first shard" do
140
144
  shards = ActiveRecord::Base.configurations[RAILS_ENV]['shard_names'].dup
141
145