Hey all, this is my plea for help, I’ve been trying to figure this out
for a day and a half without avail, please gurus at least cast your eye
upon it and try to help me out
Ok, what I’m trying to do is get the acts_as_taggable plugin to work
with many users. I’ve got a picture and a user model to work with. I can
add tags to pictures fine, but when I start trying to add models it
starts to fail.
The code that I’ve been following is at :
http://rails.techno-weenie.net/question/2006/3/6/how_to_add_user_to_acts_as_taggable
It starts at: “Sutch is right…”
I’ve changed my plugin/code to reflect the changes indicated by foo, so
I know that code is correct. The code that I’m using in
pictures_controller is
def create
@picture = Picture.create! params[:picture]
@picture.tag_with(params[:tag_list], current_user)
redirect_to :action => 'show', :id => @picture
rescue ActiveRecord::RecordInvalid
render :action => 'new'
end
which draws in from a form in a view of new.rhtml.
The error that I get is that;
" ActiveRecord::AssociationTypeMismatch in PicturesController#create
User expected, got User "
Strangely though, this error only happens on the 2nd and subsequent
times the request is run. ie: if i restart my server, it’ll allow me to
add one picture with the user_id filled in the taggigns table, but when
I go to create a new one then the error occurs.
Thank you so much for any light you can shine on the problem
Steven Hann