Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: hudson-gev-art/formtastic
...
head fork: hudson-gev-art/formtastic
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 5 files changed
  • 0 commit comments
  • 2 contributors
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+2.0.2
+
+* fixed MongoMapper argument errors on associations
+
2.0.1
* fixed that `:multiple => true` wasn't working when no association present
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
2  lib/formtastic/helpers/reflection.rb
@@ -8,7 +8,7 @@ def reflection_for(method) #:nodoc:
if @object.class.respond_to?(:reflect_on_association)
@object.class.reflect_on_association(method)
elsif @object.class.respond_to?(:associations) # MongoMapper uses the 'associations(method)' instead
- @object.class.associations(method)
+ @object.class.associations[method]
end
end
View
2  lib/formtastic/version.rb
@@ -1,3 +1,3 @@
module Formtastic
- VERSION = "2.0.1"
+ VERSION = "2.0.2"
end
View
10 spec/spec_helper.rb
@@ -295,12 +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 do |column_name|
- case column_name
- when :sub_posts
- mock('reflection', :options => {:polymorphic => true}, :klass => ::MongoPost, :macro => :has_many)
- end
- end
+ ::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])

No commit comments for this range

Something went wrong with that request. Please try again.