-
Notifications
You must be signed in to change notification settings - Fork 478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
5 new methods: undelete, set_restriction, get_primary_value, join, without_callbacks and with inside with #180
base: master
Are you sure you want to change the base?
Conversation
Allows undeletions when soft delete is enabled.
Use-case: controller’s constructor loads a model, adds a restriction (eg. “user_id = 123”), subsequent calls to the model add the restriction to all the queries. Think of it as an easy built-in security which removes the need to add the same where clause again and again on all methods.
skipping soft_delete condition when called from delete (so that we can pass unit tests)
Changing unit test following earlier fix
This pull request also fixes #87. |
Hi Julien, Thanks for your PR and email. I promise I'll take a look soon, I'm just J On 7 August 2014 12:28, Julien Tessier [email protected] wrote:
Jamie Rumbelow |
- like with_deleted() function, without_restriction() temporarly includes restricted rows - with_deleted() was not temporary and was maintained between model calls — not sure if it was on purpose or not, but this is fixed: with_deleted() only works for the current call.
I changed something in with_deleted(): contrary to the var name, it was not temporary and was maintained between calls. I'm not sure if it was on purpose or not, but this is changed: with_deleted() only works for the current call. |
if restrictions are enabled, truncate is rewritten to delete so that records which the user has no access to are not deleted
Possibility to retrieve the current primary key value, eg. in observers.
Adds a method to do a direct ActiveRecord join, eg: $this->photo_model->join('photos_selections', 'ps_photo = p_id', 'left')->get_many_by('p_album', $id)
Code cleanup
This reverts commit 7ca6900.
undelete
: pretty self-explanatory, works only when soft deleting is enabledset_restriction
: use-case: controller’s constructor loads a model, adds a restriction (eg. “user_id = 123”), subsequent calls to the model add the restriction to all the queries. Think of it as an easy built-in security which removes the need to add the same where clause again and again on all methods.get_primary_value
: gets the current primary key value, useful in observersjoin
: performs a direct ActiveRecord joinwith
now accepts a second parameter which behaves like a with() inside the get()without_callbacks
: temporarly disable callbacks