All right, I just need the last step to go.

I've done everything correctly, so the index show a briefing of the 
post, and all the tags, which are correctly linked to a proper url, 
specifically :
 let's put I click on the tag "aqua" , the specified url shall be

http://0.0.0.0:3000/posts/tag/aqua

that's just fantastic!
I've added a

def tag
    @post = Post.tagged_with(params[:name])
      respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @post }
    end
end

in PostsController.
Everything works fine, but when I put the same view/show.html.erb code 
to view/tag.html.erb , it tells me that:

the url is correct > http://0.0.0.0:3000/posts/tag/aqua

and the error is:

undefined method `title' for #<ActiveRecord::Relation:0x1041fd4c0>

This happens because it tries to fetch all the posts with ID => "aqua" , 
which don't exist.
I'm puzzled because I specified in the controller that :
@post = Post.tagged_with(params[:name])

but Rails insists in fetching the id as parameter.

Any idea?
Thanks guys!

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to