[Rails] ROR Recipes Beta: Why use taggings instead of
tags_contacts? NoMethodError tag_with?
softwareengineer 99
softwareengineer99 at yahoo.com
Sun Feb 12 22:49:46 GMT 2006
I have gotten acts_as_taggable to work for a test application as documented on taggable.rubyforge.org
I am following Chad's excellent examples in ROR Recipes Beta book.
I have a few questions and hope that Chad or some other expert can help clarify them.
1. Why is the book suggesting to use taggings table instead of tags_contacts, as mentioned on taggable.rubyforge.org?
2. How can I use this taggings table instead of my tags_contacts?
3. How can I store additional fields such as member_id in the tags_contacts table or taggings table?
4. When I follow Chad's example on my Favorite class, (with tags_favorites and taggings table created) I keep getting the NoMethodError for "tag_with"? At first I thought this may be because I am using taggings table but then when I created tags_favorites table the error persisted.
5. I finally used the tag method as described on rubyforge.org and it works. So my question is, is tag_with a typo in the book or am I missing something?
6. Why does the following output say @new_record=false even when the record was created? Is it to prevent further entry of the same record?
Loading development environment.
./script/../config/../config/../lib/localization.rb:5: warning: already initialized constant LOCALIZED_STRINGS
>> f=Favorite.create(:url=>'http://home.com', :title=>'Home Pages title', :desc=>'My note about this favorite', :created_at=>Time.now)
=> #<Favorite:0xb6f5d594 @new_record=false, @errors=#<ActiveRecord::Errors:0xb6f54bb0 @base=#<Favorite:0xb6f5d594 ...>, @errors={}>, @new_record_before_save=false, @attributes={"updated_at"=>Sun Feb 12 15:30:38 CST 2006, "title"=>"Home Pages title", "portal_id"=>0, "member_id"=>0, "id"=>12, "url"=>"http://home.com", "desc"=>"My note about this favorite", "created_at"=>Sun Feb 12 15:30:38 CST 2006}>
>> f.tag_with("home tag1 tag2")
NoMethodError: undefined method `tag_with' for #<Favorite:0xb6f5d594>
from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb:1501:in `method_missing'
from (irb):2
>> f.tag("home tag1 tag2")
=> ["home", "tag1", "tag2"]
Thank you very much for your assistance.
Frank
---------------------------------
Brings words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060212/14c85af6/attachment.html
More information about the Rails
mailing list