Hello
I need help from you all. I have 3 tables: tbl_restaurants, tbl_tags,
and tbl_res_tags. tbl_restaurants has 3 fields: res_id, name,
description. tbl_tags has tag_id and name. tbl_res_tags has tag_id and
res_id. So, tbl_restaurants has a Model "TblRestaurant". tbl_tags has
a
Model "TblTag". tbl_res_tags has a Model "TblResTag". So, I
define:
class TblRestaurant < ActiveRecord::Base
set_primary_key :res_id
acts_as_taggable :tag_class_name => "TblTag",
:join_class_name => "TblResTag",
:join_table => "tbl_res_tags",
:foreign_key => "res_id",
:association_foreign_key => "tag_id"
end
class TblTag < ActiveRecord::Base
set_primary_key :tag_id
end
When I write:
res = TblRestaurant.find(1).tag("AA BB CC")
In tbl_res_tags, there are 3 records. But, the tag_id has "0" value
and
res_id has "1" value.
So, what ''s wrong with my code? Can anyone solve this problem?
Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---