Add Mongoid support to CanCan #172

Merged
9 commits merged into from Dec 21, 2010

Projects

None yet

5 participants

@bowsersenior
Contributor

Hi Ryan,

Thanks for all the hard work on CanCan and other projects. I have been using CanCan with Mongoid Documents for over a month now. I had a monkeypatch in my app to get the two gems to work together. Recently I decided to try and add Mongoid support into CanCan out of the box.

I've got things functional and added some specs (they all pass), but I'm sure there's lots of room for improvement. Appreciate any feedback you may have. I'll do my best to fix any problems.

Smiles,
Mani (github: bowsersenior)

@ryanb
Owner
ryanb commented Oct 14, 2010

This looks awesome, thanks! I'll schedule this to be added to the 1.5 release.

@bowsersenior bowsersenior Fix accessible_by for Mongoid documents when no ability is defined.
The previous spec that checked for this was not right, since there were no documents in the collection, so every query would return an empty result.
25bf479
@bowsersenior
Contributor

Cool. Just fixed a little bug. I'll continue to make tweaks and improvements as they come to mind.

bowsersenior added some commits Oct 15, 2010
@bowsersenior bowsersenior Fix bug with CanDefinition#tableized_conditions being used with Mongo…
…id documents and add more specs for accesible_by with Mongoid.
d256aeb
@bowsersenior bowsersenior Fix bug with Mongoid document where :manage :all caused accessible_by…
… to return nothing and add specs to test for :manage :all.
dbcd93e
@iamnader
iamnader commented Nov 9, 2010

can't wait to have accessible_by support for mongoid!

tylergannon and others added some commits Nov 16, 2010
@tylergannon tylergannon can? should only go to db if there are mongoid criteria in the condit…
…ions.

Easier to just do a simple comparison on the object in memory
than to search the database.  Also this allows method calls
and other attributes that might not be found in the database.
f6aaa58
@bowsersenior bowsersenior Update specs for MongoidAdditions to use rr mocks 5ebca1f
@bowsersenior
Contributor

tylergannon was kind enough to clean up and streamline the Mongoid support code in my fork.

@ryanb
Owner
ryanb commented Dec 21, 2010

This is pulled in, thanks bowsersenior! It will be in the 1.5 release.

@bowsersenior
Contributor

Awesome!

@kashdan
kashdan commented Mar 1, 2011

Thinks guys!

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