Hello,
      In my rails application, I have a book model.
      I want to add tags. For  that I have installed
      acts_as_taggable_on_steroids  from this link
     http://agilewebdevelopment.com/plugins/acts_as_taggable_on_steroids
     and do as the readme file.
 This is my Model :
  class Book < ActiveRecord::Base
    acts_as_taggable
  end

 Here is my ApplicationHelper :
module ApplicationHelper
  include TagsHelper
end

And I couldn't get the idea what should I add in the controller to save
tags(please guide me to save tags) . I just try to follow the readme and
Edited part of BookController is:

def create
    @book = Book.new(params[:book])
    @book.tag_list # []
    @book.tag_list = "Funny, Silly"
   respond_to do |format|
      if @book.save
        flash[:notice] = 'Book was successfully created.'
        format.html { redirect_to(@book) }
        format.xml  { render :xml => @book, :status => :created,
:location => @book }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @book.errors, :status =>
:unprocessable_entity }
      end
    end
  end

def tag_cloud
      @tags = Books.tag_counts
    end

In the new.html.erb I have added these lines :
<% tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| %>
    <%= link_to tag.name, { :action => :tag, :id => tag.name }, :class
=> css_class %>
  <% end %>

After I restarting the server, When I want to create a new book entry it
shows error as below:

"You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.empty?"
And the error details shows that the error is in tag_cloud

When I add a TagList.delimiter = " "  in config/environment.rb
and restart the server.. the server stop with error showing as
uninitialized constant TagList .

Please help me as I am new in ruby.
Thanks in advance.
-- 
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to