Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Model.all with parameters is deprecated

  • Loading branch information...
commit 4130a19dc6d87b56dfbf6f67e5f926cff82a2a17 1 parent e78600c
@twalpole twalpole authored
View
4 lib/formtastic/inputs/base/collections.rb
@@ -88,7 +88,7 @@ def collection_from_association
if Util.rails3?
reflection.klass.scoped(scope_conditions).where(conditions_from_options)
else
- reflection.klass.all(scope_conditions).where(conditions_from_options)
+ reflection.klass.where(scope_conditions[:conditions]).where(conditions_from_options)
end
else
@@ -96,7 +96,7 @@ def collection_from_association
find_options_from_options.merge!(:include => group_by) if self.respond_to?(:group_by) && group_by
reflection.klass.scoped(scope_conditions).where(find_options_from_options)
else
- coll = reflection.klass.all(scope_conditions)
+ coll = reflection.klass.where(scope_conditions)
coll = coll.includes(group_by) if self.respond_to?(:group_by) && group_by
coll.where(find_options_from_options)
end
View
6 spec/inputs/select_input_spec.rb
@@ -228,7 +228,7 @@
if Formtastic::Util.rails3?
::Author.should_receive(:scoped).with(:conditions => {:active => true})
else
- ::Author.should_receive(:all).with(:conditions => {:active => true})
+ ::Author.should_receive(:where).with(:conditions => {:active => true})
end
semantic_form_for(@new_post) do |builder|
@@ -242,7 +242,7 @@
::Author.should_receive(:where).with({:publisher => true})
else
proxy = stub
- ::Author.should_receive(:all).with(:conditions => {:active => true}).and_return(proxy)
+ ::Author.should_receive(:where).with({:active => true}).and_return(proxy)
proxy.should_receive(:where).with({:publisher => true})
end
@@ -322,7 +322,7 @@
Author.should_receive(:where).with(:include => :continent)
else
proxy = author_array_or_scope(@authors)
- Author.should_receive(:all).and_return(proxy)
+ Author.should_receive(:where).and_return(proxy)
proxy.should_receive(:includes).with(:continent).and_call_original
end
View
7 spec/support/custom_macros.rb
@@ -258,11 +258,8 @@ def it_should_apply_error_logic_for_input_type(type)
def it_should_call_find_on_association_class_when_no_collection_is_provided(as)
it "should call find on the association class when no collection is provided" do
- if Formtastic::Util.rails3?
- ::Author.should_receive(:where)
- else
- ::Author.should_receive(:all)
- end
+ ::Author.should_receive(:where)
+
concat(semantic_form_for(@new_post) do |builder|
concat(builder.input(:author, :as => as))
end)
Please sign in to comment.
Something went wrong with that request. Please try again.