Datamapper compatibility #194

wants to merge 1 commit into


None yet
2 participants

Datamapper is not compatible to nested_form.

To have the accepts_nested_attributes_for in Datamapper you need use the gem : dm-accepts_nested_attributes.

But if you use it, nested_form is not compatible because 2 problems :

1. reflect_on_association

This method is not design in Datamapper. You need use the klass.repository[association].target_model instead.

2. _destroy is not define

In this gem the attribute to mark a record destroy is _delete instead of _destroy on ActiveRecord. And there are no method _destroy or _delete in the instance to check if this object can be delete or not in futur.

This pull request help to work DataMapper and nested_form together. But actually, it's not compatible to ActiveRecord anymore. I can do the job to be compatible both. But I prefer start avoid it in first and do the job if needed.

Spec failed because this incompatibility.


lest commented Sep 17, 2012

I think we should think about extracting ActiveRecord dependent code into a module at first. Then we could easily add DataMapper or any other ORM compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment