nathanl / authority

*CURRENTLY UNMAINTAINED*. Authority helps you authorize actions in your Rails app. It's ORM-neutral and has very little fancy syntax; just group your models under one or more Authorizer classes and write plain Ruby methods on them.
MIT License
1.21k stars 67 forks source link

Refactor overridden_actions #76

Closed capicue closed 10 years ago

capicue commented 10 years ago

Observed Issue

The overridden_actions method gets applied twice to the options parameter of authorize_actions_for. As a result, a type error is thrown if options is of the form {:actions => {:actions => :read}}.

Fix

nathanl commented 10 years ago

I'm happy to merge a refactor, but I don't really understand the use case you describe. Why would you ever pass {:actions => {:actions => :read}}? It would be very strange to have a controller method called actions, wouldn't it?

nathanl commented 10 years ago

Merged because I think the code looks better with your changes, but I'm going to delete the spec that says "it doesn't throw an error if the actions hash has an :actions key" because I think that's an edge use case and doesn't need to be documented in the tests.

nathanl commented 10 years ago

Thanks for the patch! :)