stffn / declarative_authorization

An unmaintained authorization plugin for Rails. Please fork to support current versions of Rails
MIT License
1.24k stars 233 forks source link

Rails4 #198

Closed divoxx closed 7 years ago

divoxx commented 10 years ago

I found a bug on Rails 4, after the merge of #196. Basically, when working with an association proxy, sometimes it would create an new object to use for the authorization but that object would then be lingering in the association collection. So, later on the controller or view your association collection would have an unsaved unpopulated object.

This change ensures that the object gets removed after the authorization happen.

There is some noise on the PR due editor cleaning up whitespace. I added comments to the actual changes. Would be nice to have other people test it.

@zeiv, @gordonbisnor, @aepstein and @maletor: thoughts?

maletor commented 10 years ago

Ya, I think this is good. I'd remove the whitespace and do that as a separate style pull request, but otherwise :+1:.

divoxx commented 10 years ago

I just found another issue, there is more work to be done here. I'll let you guys know when it's done.

stffn commented 10 years ago

Is it possible to have a test case for the problem that shows the issue and that it is solved?

zekefast commented 10 years ago

@divoxx, Thank you for your fix!

@stffn, Do you have any information when this PR could be merged to master? Thank you in advance!

divoxx commented 8 years ago

Was this addressed on a separate patch? Does this PR still make sense? We're currently using our fork with this fix but I'd love to go back to mainstream repo.