Fix for issue #332 #393

wants to merge 5 commits into


None yet

4 participants


Fix for issue #332

bjornblomqvist added some commits Dec 12, 2011
@bjornblomqvist bjornblomqvist Added the macro method from ActiveRecord::Reflection::MacroReflection…
… to make Formtastic happy.

This makes it possible to use mongomappers "many" in combination with Formtastics ":collection => ...".

<%= form.input :themes ,:as => :select, :collection => Theme.all %>
@bjornblomqvist bjornblomqvist Revert "Added the macro method from ActiveRecord::Reflection::MacroRe…
…flection to make Formtastic happy."

This reverts commit 4d83cac.
@bjornblomqvist bjornblomqvist Merge branch 'master' of git:// a64d67e
@bjornblomqvist bjornblomqvist Adding test to trigger issue #332
mongomapper#332 (comment).

form_for in rails expects doc.#{name}_before_type_cast to retun the default value.
@bjornblomqvist bjornblomqvist fix for Issue #332 f6d559b



Seems like it would be better to just make sure that attributes with defaults are always set in initialize. That is what I did in toy store.



Two thoughts.

1) Setting defaults on initialize makes sure that defaults like bellow behaves the way people exepct it to (Set on initalize).

:default => lambda { }

2) Setting them on initialize makes new just a tiny bit slower.

I think setting it on initialize is the better way to do it.


Thanks for the pull request! I'm going to close this one for now, but I'd love to see this fixed. Please open another pull request that sets them on initialize.


@bkeepers bkeepers closed this Mar 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment