Skip to content
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

modifier_id is not set when updating the record #139

Open
kotaiahpendurthi opened this issue Jun 25, 2015 · 3 comments
Open

modifier_id is not set when updating the record #139

kotaiahpendurthi opened this issue Jun 25, 2015 · 3 comments
Labels

Comments

@kotaiahpendurthi
Copy link

Hi i am using mongoid-history gem along with the device gem for authentication.

Following is the code snippet in my mongoid-history.rb(initializer)

Mongoid::History.tracker_class_name = :history_tracker
Mongoid::History.current_user_method = :current_user

Following is the code snippet in one of my model

include Mongoid::History::Trackable

telling Mongoid::History how you want to track changes

track_history :track_create => true, # track document creation, default is false
:track_update => true, # track document updates, default is true
:track_destroy => true, # track document destruction, default is false
:changes_method => :changes_with_schedule,
:modifier_field => :modifier

But modifier_id is not updating on updating the record.

Please let me know if i am missing something or modifier field doesn't support the deveice gem

@dblock
Copy link
Collaborator

dblock commented Jun 26, 2015

It looks like we removed any automatic current_user code in #83 because the observer functionality, which supported this feature, was removed in Rails 4. It seems like there's still some code lingering here, notably setting current_user_method - @kotaiahpendurthi would you mind making a PR that removes that?

This means you will have to assign the modifier explicitly in your code.

@melnikaite
Copy link

#149

@jnfeinstein
Copy link
Collaborator

I was just bit by this, trying to set current_user_method and coming up with a blank modifier. It's pretty easy to come across in code, which eventually led me here trying to figure out why the method doesn't do anything. Everything else is working smoothly. 👍

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

No branches or pull requests

4 participants