ruby on rails 3 - tagged_with always show me an empty array (acts-as-taggable-on) -


Using I-Like-Tagable (3.0.1) and I tried to put some code on the console :

  irb (main): 005: 0 * Noticia.last.tags => [# & Lt; ActsAsTaggableOn :: ID: 915 9, name: "oil"> gt;] irb (main): 006: 0> NotgateGag_Width ("Oil") = & gt; []  

I have seen that my second query is not included in a SQL Add:.

  Select Noticia Load (0.5ms) "noticia" * From "noticia" where (deleted_at IS NULL) by noticia.id_noticia DESC limit1 ActsAsTaggableOn :: Tags Load Order (0.5ms) Select "tag". ("Taggings" .taggable_id = 10630) and ("taggings" .taggable_type = 'noticia') and ((taggings) "tag tags" from "tag tags" .context = ('tags')))) Select ActsAsTaggableOn :: Load Tags (3.9ms) Select "Tags". * Select "tag" (short (name) = 'oil') Noticia load (0.3ms) from "noticia". * From "noticia" where (deleted_at is zero) and (1 = 0)  

I do not know what the problem is, in the work-tagable document say that I Just 'model. I've followed these steps to configure Tagged '("my_tag")' on Task-A-Tag-On

I had such a problem:

  & gt; Post = post. Build (Body: "Hello World") = & gt; & Lt; Post id: 9, title: zero, body: "hello world", author_id: zero, author_type: zero, created_at: "2015/10/07 08:53:32", updated_at: "2015/10/07 08: 53 : 32 "& gt; & Gt; Post.tag_list.add ('Hello', 'World') = & gt; ["Hello", "world"] & gt; PostTag_Ideal ('Hello') = & gt; & Lt; ActiveRecord :: Relation [] & gt; & Gt; PostTag_Id ('World') = & gt; & Lt; ActiveRecord :: Relation [] & gt;  

My mistake was that I just forgot to save your post after adding the tag to the post's tag list :)

  & gt; Post.save = & gt; True & gt; PostTag_Ideal ('Hello') = & gt; & Lt; ActiveRecord :: Relation [# & LT; Post ID: 9, Title: Zero, Body: "Hello world", author_id: zero, author_type: zero, created_at: "2015/10/07 08:53:32", updated_at: "2015-10-07 08:53 : 32 "& gt;] & gt;  

Comments