Closed aj7 closed 14 years ago
Hi aj7,
Could you explain further? I can't tell what your problem is from this note, if it's a problem with acts_as_commentable, etc. Maybe a code sample?
jack
Hi jack, Could you maybe tell me how the user is being saved?do I have to do this explicitly? As explained earlier, I have got a user model already.do I need to do anything else to hook the user into the comment model? I was assuming that since this is based on act_as_taggable, which am using too, the user is saved automatically is a current_user method exists?
aj7,
How the user is saved is completely up to your application, so yes, you have to save them explicitly.
So, if you're asking how you associate a user with a comment, you would want to do something like this for instance:
comment = Comment.create(params[:comment].merge(:user => current_user))
Does that answer your question?
Hi Jack, yes well this is what I am doing already - another nice feature for the gem/plugin then would be to save the user automatically if a current_user method is present in the project. I will see if I have some time to update this sometimes...thanks for the gem btw...good work.
aj7,
Ah, I see, glad we got that cleared up.
I worry that using current_user automatically like that would be a bit too much magic. I didn't realize acts_as_taggable behaved that way either. Which version of that plugin does that? I'd like to see how they do it.
And no prob,I certainly don't deserve credit for writing this...just helped it get onto github and update things a bit here and there :-)
hey jack, it's quite normal to associate a user to comments - so if the current_user is present, then why not save it -else the implementer could choose to explicitly save a different user if required.
my mistake, its not on the acts_as_taggable (i use the act_as_taggable_on btw). but its on all the versionning gems e.g. papertrail http://github.com/airblade/paper_trail
hi, the user is not being saved as part of the comment. do i need to do anything special for this to work? i have got a user model already (using authlogic). At present, i am explictly saving the user. I have got a current_user . thanks for your help