formtastic 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 2.0.2
2
+
3
+ * fixed MongoMapper argument errors on associations
4
+
1
5
  2.0.1
2
6
 
3
7
  * fixed that `:multiple => true` wasn't working when no association present
@@ -321,7 +321,7 @@ module Formtastic
321
321
  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.")
322
322
  end
323
323
  elsif @object.class.respond_to?(:associations)
324
- if (@object.class.associations(method.to_sym) && @object.class.associations(method.to_sym).options[:polymorphic] == true)
324
+ if (@object.class.associations[method.to_sym] && @object.class.associations[method.to_sym].options[:polymorphic] == true)
325
325
  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.")
326
326
  end
327
327
  end
@@ -8,7 +8,7 @@ module Formtastic
8
8
  if @object.class.respond_to?(:reflect_on_association)
9
9
  @object.class.reflect_on_association(method)
10
10
  elsif @object.class.respond_to?(:associations) # MongoMapper uses the 'associations(method)' instead
11
- @object.class.associations(method)
11
+ @object.class.associations[method]
12
12
  end
13
13
  end
14
14
 
@@ -1,3 +1,3 @@
1
1
  module Formtastic
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -295,12 +295,10 @@ module FormtasticSpecHelper
295
295
 
296
296
  ::MongoPost.stub!(:human_attribute_name).and_return { |column_name| column_name.humanize }
297
297
  ::MongoPost.stub!(:human_name).and_return('MongoPost')
298
- ::MongoPost.stub!(:associations).and_return do |column_name|
299
- case column_name
300
- when :sub_posts
301
- mock('reflection', :options => {:polymorphic => true}, :klass => ::MongoPost, :macro => :has_many)
302
- end
303
- end
298
+ ::MongoPost.stub!(:associations).and_return({
299
+ :sub_posts => mock('reflection', :options => {:polymorphic => true}, :klass => ::MongoPost, :macro => :has_many),
300
+ :options => []
301
+ })
304
302
  ::MongoPost.stub!(:find).and_return([@freds_post])
305
303
  ::MongoPost.stub!(:all).and_return([@freds_post])
306
304
  ::MongoPost.stub!(:where).and_return([@freds_post])
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formtastic
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 1
10
- version: 2.0.1
9
+ - 2
10
+ version: 2.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin French
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-03 00:00:00 +11:00
18
+ date: 2011-10-06 00:00:00 +11:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency