-
Notifications
You must be signed in to change notification settings - Fork 480
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
Ignore triggers #113
Comments
that would be helpful for me as well. can you share the code if you are not able to make a commit. thanks! |
+1 The first method: The second method: I prefer the first method. |
A second thought: A combination of the both ways would be the best. Edit: I choose the first method, because it is simpler. Performance optimizations may be done later, if they are needed. |
Somebody interested may make a back-port. |
A real usage: I've got a table with user accounts and the corresponding model has the observers 'created_at', 'created_by', 'updated_at', 'updated_by'. Also I have a field 'last_logged_in_at' that stores current time when user logs in. While this field is to be updated, I don't want the fields 'updated_at' and 'updated_by' to get changed, and skip_observers() helps for that. As an alternative, the basic CodeIgniter's query builder may be used, but code will loose its beauty. Other similar cases: Storing number of page previews, "likes" or rates, without touching anything else within records. |
I like it. Submit a PR, @ivantcholakov, and I'll merge it in |
My implementation is on a clone that is getting quite different. Before implementing this feature would you allow minor refactoring? It would be easier if there is a method |
You can submit a pull request by cherry picking the commit into a separate branch, and then PRing on that branch. Like this:
Then switch onto skip_observers in your GH repo, and submit a PR from there! |
Just a note for me: $ git checkout -b skip_observers jamierumbelow/master
fatal: Cannot update paths and switch to branch 'skip_observers' at the same time.
Did you intend to checkout 'jamierumbelow/master' which can not be resolved as commit? This works: $ git fetch jamierumbelow master:skip_observers |
I have both a
$before_create
and$before_update
. Sometimes I want to update a row without touching those triggers. I couldn't see a way to do it with anything already built in, so I added a $skip_triggers to function update. Should I put in a PR for this?The text was updated successfully, but these errors were encountered: