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

Does not show the true creator of the Crumb #6

Open
jimishjoban opened this issue Mar 22, 2013 · 1 comment
Open

Does not show the true creator of the Crumb #6

jimishjoban opened this issue Mar 22, 2013 · 1 comment

Comments

@jimishjoban
Copy link

Hey guys,

Great gem! Found this issue:

Lets say User A creates a new comment.
User B (Moderator) edits this comment.
Changes are recorded fine... But if we do

crumb = c.crumbs.last
crumb.creator

It would print User A as the crumb creator instead of User B...

@JonMidhir
Copy link
Member

@jimishjoban I guess this is a little out of date now, sorry! ⌚

The creator is assigned using a method on the model you're tracking and uses the options you've set at initialization. This method can be easily overridden on a class by class basis. Something like this might suit you:

class Comment < ActiveRecord::Base
  def creator
    # Whatever you want to assign as the creator
    if new_record?
      super
    else
      editors.last
    end
  end
end

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

No branches or pull requests

2 participants