Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

While we wait for 1.6.11... #989

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

While we wait for 1.6.11... #989

wants to merge 23 commits into from

Conversation

bryanrite
Copy link

I've taken a number of the pull requests that address rails 4 issues, but also just general query bugs and rolled them up into single PR... the idea being if people want to use a more up to date version of CanCan.

In a nutshell:

  • It moves up to 1.9.3 (but still supports 1.8.7)
  • Fixes several bugs (shallow routing, nested conditions, class level scoping, multiple rule issues with associations)
  • Fixes several Rails 4 incompatibilities (scoping, deprecation warnings)
  • Adds strong_parameters support
  • Uses .ruby-version instead of .rvmrc
  • jRuby support.

This PR combines:

#726
#864
#871
#906
#935
#966
#971
#974
#977
#980
#988

Thank you to all the other contributors!

ricec and others added 21 commits January 27, 2014 09:54
@conditions.empty? calls ActiveRecord::Relation#empty? when a scoped condition is provided. ActiveRecord::Relation#empty? will query the database while CanCan only needs to check if conditions are set on the rule.
There are two issues with the current way cancan handles associations:

1) Records are returned multiple times in some circumstances
2) Several defined abilities prevent some records to show up under certain circumstances

This commit includes tests for both cases. It fixes both problems by changing `joins` to `includes` for the AR adapters. This could have performance implications, since `includes` will also select all columns in the associated records. We tried various ways of achieving the same thing using Arel directly, but were unable to make this work due to lack of support for outer joins in Rails 3.1.

This closes issues ryanb#724, ryanb#566 and ryanb#613
@bryanrite
Copy link
Author

I've already been asked to keep 1.8.7, so i'll submit a patch in a few to keep it going.

@JustinAiken
Copy link

👍

@lpradovera
Copy link

👍 , this really needed to be done!

@zdavis
Copy link

zdavis commented Jan 28, 2014

Yeah, this is awesome. Thanks.

@MattRogish
Copy link

👍

@bryanrite
Copy link
Author

Thanks guys... this will be a living pull request, i'll keep adding other PRs as needed.

@vendethiel
Copy link

Great piece of work. Thanks!

@xhoy
Copy link

xhoy commented Feb 9, 2014

@kuraga Afaik he is still alive, at least when i read this thread yesterday, since i had some rails 4 cancan issues.I did some research and he does login to his stackoverflow account sometimes and even comments ( http://stackoverflow.com/users/148722/ryanb ) and he made changed a gist 18 days ago ( https://gist.github.com/ryanb/4172391 ).
Other then that i don't know where he is or what he does, i only watch his railscasts, and use his awesome gems but other then that i don't know him :)

Is there anyone that can confirm he/she send him an email at all? or is everyone waiting for somebody else to do that.

@willkoehler
Copy link

I exchanged emails with @nashby who is a collaborator on CanCan. His only contact with Ryan was through ryan@railscast.com. I tried sending an email to Ryan at that address and also sent him a tweet https://twitter.com/wckoehler/status/432529759797387264.

@elthariel
Copy link

@bryanrite Maintainance work on CanCan would surely be a good thing for the community. Although i've started switching my project to Authority gem, It's still a blocker on many people's upgrade path to rails 4 who really enjoy this tool and doesn't want to replace it.

Is there a known list of hackers except you that would be willing to contribute some time on it ?

@willkoehler
Copy link

@elthariel @bryanrite I don't think we're going to hear from @ryanb. It seems like he wants to keep a low profile and we should respect that. I think it's time to move forward with a fork. I'll will help out as a core contributor, reviewing issues and pull requests and updating documentation.

Do you think there's a chance rubygems.org will allow us to continue publishing under the cancan name until @ryanb returns? Otherwise any ideas for a new name?

@lpradovera
Copy link

Count me in, I am using this fork in at least a couple large projects.

If we are going with a pun name, we should name the fork “couldcan” :)

Luca Pradovera
luca.pradovera@gmail.com

On Feb 19, 2014, at 5:49 PM, Will Koehler notifications@github.com wrote:

@elthariel @bryanrite I don't think we're going to hear from @ryanb. It seems like he wants to keep a low profile and we should respect that. I think it's time to move forward with a fork. I'll will help out as a core contributor, reviewing issues and pull requests and updating documentation.

Do you think there's a chance rubygems.org will allow us to continue publishing under the cancan name until @ryanb returns? Otherwise any ideas for a new name?


Reply to this email directly or view it on GitHub.

@JustinAiken
Copy link

  • chahut (original name of the can can)
  • cancancant
  • bryanritecan
  • cancan_fork_thats_actually_maintained
  • cancan2

I'll help with the fork too, I don't want to learn a new framework :p

@elthariel
Copy link

  • railswecan :)

On Wed, Feb 19, 2014 at 6:31 PM, JustinAiken notifications@github.comwrote:

  • chahut (original name of the can can)
  • cancancant
  • bryanritecan
  • cancan_fork_thats_actually_maintained
  • cancan2

I'll help with the fork too, I don't want to learn a new framework :p

Reply to this email directly or view it on GitHubhttps://github.com//pull/989#issuecomment-35524760
.

@bryanrite
Copy link
Author

I was just testing out the branch on a couple of my bigger clients stuck on 1.6.9. Everything seems to be good and so far it's a viable drop in replacement for the 1.x line.

I'm going to cut a new gem, and start it at version 1.7.0 (following SemVer) so it's a simple and intuitive upgrade path.

I am stuck on a name, I want it to be obvious that it's a continuation of Ryan's work, so sticking to a variant of cancan:

cancant
cancancan
cancannot
cancan_2_revenge_of_the_can (:smile:)

Thoughts?

Bryan Rite

Sent from my mobile device so I apologize for any errors.

On Feb 19, 2014, at 8:49 AM, Will Koehler notifications@github.com wrote:

@elthariel @bryanrite I don't think we're going to hear from @ryanb. It seems like he wants to keep a low profile and we should respect that. I think it's time to move forward with a fork. I'll will help out as a core contributor, reviewing issues and pull requests and updating documentation.

Do you think there's a chance rubygems.org will allow us to continue publishing under the cancan name until @ryanb returns? Otherwise any ideas for a new name?


Reply to this email directly or view it on GitHub.

@lpradovera
Copy link

If you would like to go with the “continuation” name I would rather not have a negative in it.
“cancancan” is different enough and is a clever pun on “putting cancan in the can” :)

Luca Pradovera
luca.pradovera@gmail.com

On Feb 19, 2014, at 6:42 PM, Bryan Rite notifications@github.com wrote:

I was just testing out the branch on a couple of my bigger clients stuck on 1.6.9. Everything seems to be good and so far it's a viable drop in replacement for the 1.x line.

I'm going to cut a new gem, and start it at version 1.7.0 (following SemVer) so it's a simple and intuitive upgrade path.

I am stuck on a name, I want it to be obvious that it's a continuation of Ryan's work, so sticking to a variant of cancan:

cancant
cancancan
cancannot
cancan_2_revenge_of_the_can (:smile:)

Thought?

Bryan Rite

Sent from my mobile device so I apologize for any errors.

On Feb 19, 2014, at 8:49 AM, Will Koehler notifications@github.com wrote:

@elthariel @bryanrite I don't think we're going to hear from @ryanb. It seems like he wants to keep a low profile and we should respect that. I think it's time to move forward with a fork. I'll will help out as a core contributor, reviewing issues and pull requests and updating documentation.

Do you think there's a chance rubygems.org will allow us to continue publishing under the cancan name until @ryanb returns? Otherwise any ideas for a new name?


Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub.

@willkoehler
Copy link

@bryanrite Sounds great. @polysics I was also thinking "cancancan". Simple extension of the name with no negatives.

@scaryguy
Copy link

What about canable? :)

@bryanrite
Copy link
Author

Thats 3 for cancancan...sold!

I'll cut it ASAP.

@elthariel
Copy link

OpenSource at work, my favorite web show

On Wed, Feb 19, 2014 at 6:58 PM, Bryan Rite notifications@github.comwrote:

Thats 3 for cancancan...sold!

I'll cut it ASAP.

Reply to this email directly or view it on GitHubhttps://github.com//pull/989#issuecomment-35527722
.

@vendethiel
Copy link

High-fiving you at next parisRB too ;)

@bryanrite
Copy link
Author

Alright! This branch as it is now has been released as cancancan 1.7.0:

https://rubygems.org/gems/cancancan

Please let me know if anyone has any issues with it. It should just drop in, with no code changes.

I'm going to keep this issue open, so people can see we've moved on, but please start posting any issues etc. in the new repo:

https://github.com/bryanrite/cancancan

@willkoehler
Copy link

Awesome! Thanks @bryanrite. I'll switch my apps over to cancancan and make sure everything still works. I was using your branch before so it should go smoothly.

Please reach out to me and let me know what I can do to help as issues come up.

@gamov
Copy link

gamov commented Feb 20, 2014

Good to see things moving for cancan!
What about people (like me) that use cc2.0?

@pokonski I'm also a lover of accessible_by and scopes that cancan provides.

@bryanrite
Copy link
Author

@gamov I'm focusing on the 1.x branch for the short term, making sure it is up to date and compatible going forward. I'd also like to spend a bit more time on the test suite and refactoring the code base a little to clean it up. Then I was going to take a look at the 2.x branch. I never used it since it was never actually released and I need to understand what improvements and refinements Ryan was attempting and how, before I feel comfortable moving forward with it.

Pull requests are welcome anytime if there is anyone knowledgable about the 2.x branch.

@pokonski
Copy link

@gamov just as an update. I realized thanks to comments in this thread that people still want features like AR integration.

So I'm working on scopes and accessible_by? for my AccessGranted gem to match the functionality of CanCan. Stay tuned :)

@codyolsen
Copy link

@bryanrite Thanks for spearheading this reboot. Onward and upward! Quick question: Once the new fork gains traction are you planning on giving merge privileges to additional contributors so that we can help you avoid burn out as well? Excited for the momentum!

@codyolsen
Copy link

@pokonski Do you have an estimated timeline or goal date on when you would like to have AR Integration added to AccessGranted?

@bryanrite
Copy link
Author

@codyolsen Absolutely, I was gonna setup an open source organization on GitHub and transfer cancancan into it with other maintainers if it catches on and there is some interest.

@codyolsen
Copy link

@bryanrite that sounds great! I just added an issue detailing the transition and linking to the new repository. Hopefully that will catch peoples eye and help drive traffic towards the new repo.

@pokonski
Copy link

@codyolsen this is what I'm working right now @ https://github.com/pokonski/access-granted-rails
I want to have a working version of accessible_by? and scopes for AR and Mongoid/Mongo_Mapper in the next two weeks.

@willkoehler
Copy link

@bryanrite I dropped cancancan into two apps that were previously using cancan. The transition has been seamless. All specs pass and it's been live in production now for a few days.

@bryanrite
Copy link
Author

😄

@elthariel
Copy link

Great news ! Good job :D

On Tue, Feb 25, 2014 at 8:01 PM, Bryan Rite notifications@github.comwrote:

[image: 😄]

Reply to this email directly or view it on GitHubhttps://github.com//pull/989#issuecomment-36044410
.

@hail2skins
Copy link

Just checking here to see if CanCan is still a solution anymore and am happy to see you moving this Bryan. I don't know you, but I'll support your effort and try to use your work and one day maybe help. Appreciate it.

@gamov
Copy link

gamov commented Feb 28, 2014

@bryanrite I use cc2 in production for a very long time already. I like it much better than 1.x.
There is a few bugs (see open issues) but I could easily work around them.

The only part that I find unfinished (thus unusable) is regarding the resource attributes authorisation. It's not flexible enough as it is (see #513).

I'm keen to test and feedback any work on this branch.

PS: Because of some dependencies, I'm stuck on Rails 3.0.20 for now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.