Skip to content
Browse files

this should fix the remaining problems.

  • Loading branch information...
1 parent 96fcaa6 commit ce46f6b0194619418789e2b1946fa0bb784c34db @hypomodern hypomodern committed with justinfrench Sep 12, 2011
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/formtastic/helpers/inputs_helper.rb
  2. +4 −0 spec/spec_helper.rb
View
2 lib/formtastic/helpers/inputs_helper.rb
@@ -321,7 +321,7 @@ def fieldset_contents_from_column_list(columns)
raise PolymorphicInputWithoutCollectionError.new("Please provide a collection for :#{method} input (you'll need to use block form syntax). Inputs for polymorphic associations can only be used when an explicit :collection is provided.")
end
elsif @object.class.respond_to?(:associations)
- if (@object.class.associations(method.to_sym) && @object.class.associations(method.to_sym).options[:polymorphic] == true)
+ if (@object.class.associations[method.to_sym] && @object.class.associations[method.to_sym].options[:polymorphic] == true)
raise PolymorphicInputWithoutCollectionError.new("Please provide a collection for :#{method} input (you'll need to use block form syntax). Inputs for polymorphic associations can only be used when an explicit :collection is provided.")
end
end
View
4 spec/spec_helper.rb
@@ -295,6 +295,10 @@ def new_author_path(*args); "/authors/new"; end
::MongoPost.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
::MongoPost.stub!(:human_name).and_return('MongoPost')
+ ::MongoPost.stub!(:associations).and_return({
+ :sub_posts => mock('reflection', :options => {:polymorphic => true}, :klass => ::MongoPost, :macro => :has_many),
+ :options => []
+ })
::MongoPost.stub!(:find).and_return([@freds_post])
::MongoPost.stub!(:all).and_return([@freds_post])
::MongoPost.stub!(:where).and_return([@freds_post])

0 comments on commit ce46f6b

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