指定依赖的gem(environment.rb):
然后解压到vender:
Tags:
how to get your grub back when you reinstalled your windoz?
Here are the quickfire steps to use the acts_as_taggable gem...
1. In your project database, add two tables, tags and tags_[model you're linking to], here's an example sql script:
2. at a command prompt, from in your project directory, run
gem install acts_as_taggable
3. Add this line right above the end in your environment.rb
require_gem 'acts_as_taggable'
4. Create a tag model. You can do this manually or with the generator like so:
ruby script\generate model Tag
5. In your target object's model.rb file (books.rb in this case) add
acts_as_taggable
6. In your target object's controller (books_controller.rb for us) add this line under your
if @books.save line..
@book.tag(params[:tags])
7. Add this to your _forms partial
tags for this book: <%= text_field_tag('tags', '') %>
8. To get the items to show in yor list.rhtml view, you can call them with this
<%= book.tag_names.join(" ") %>
That's the quick way to get acts_as_taggable working. For more functionality, check this out.
Tags:
Copyright © 2007