I just discovered that load_and_authorize_resource calls find on the model at https://github.com/ryanb/cancan/blob/master/lib/cancan/controller_resource.rb#L103, but DataMapper models should be called with get instead of find.
I just forked @emmanuel's fork with the intention of fixing this right away, but I'm not sure what the best way to implement this would be. I'm guessing you probably don't want datamapper specific logic in CanCan::ControllerResource.
Suggestions on how to implement this?
I think the best fix here might be to add model_adapter#find to the model_adapter interface, but that might be too invasive. It definitely looks like loading doesn't currently work without providing a (roughly) AR::Base#find-compatible interface.
Hi, I just discovered this myself... cancan is getting an Enumerator over all objects in the database from Class(Enumerable)#find.
I'd like to see this maxsum-corin@c849a1d, but I'm not making a pull request because this would break the current usage of :find_by... maybe a new option, :finder, might be appropriate?
Ok made pull request now: #376
What do you think?
Just noticed this is a dup of #373
Ok this seems to be working, but now my nested resources don't :( returns all)
delegating ControllerResource find to model adapter, uses 'get' for D…
…ataMapper - closes #373