Skip to content

Commit

Permalink
this should fix the remaining problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
hypomodern authored and justinfrench committed Oct 5, 2011
1 parent 96fcaa6 commit ce46f6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/formtastic/helpers/inputs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit ce46f6b

Please sign in to comment.