Help appreciated on acts_as_taggable issue

Hi,

I have added acts_as_taggable to one of my models called Picture, I then
try to pick up some tags through the following code:

user = User.find(session[:user_id])
photo = Picture.new (@params[“picture”])

photo.tag(@params[“picture_tags”]) <<
user.pictures << photo

I’m trying to use the acts_as_taggable plugin, but I’m finding that my
tags
table is not getting the tags saved for the above line in question (>>
… <<).

However, if I do this instead:

user = User.find(session[:user_id])
photo = Picture.new(@params[“picture”])

photo.tag ‘brazil soccer’ <<
user.pictures << photo

It is getting saved successfully but obviously I manually set the tags.
I can’t seem to figure out why the bulk set of tags aren’t getting set
in the
tables. Any help would be appreciated.

Thanks.

photo.tag(@params[“picture_tags”]) <<
user.pictures << photo

photo.tag ‘brazil soccer’ <<
user.pictures << photo

Have you verified params[“picture_tags”] isnt empty ? What does the
form look like that submits the tags ?

A.
p.s. you should probably use params rather than @params

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs