On Fri, Sep 2, 2011 at 3:21 AM, Leo M. <li...@ruby-forum.com> wrote: > I tried to do as you suggested but it doesn't show anything. I've tried > also to figure out if it wasn't a nil object but it's not even this. > For instance, on tag.html.erb : > > <% @posts.each do |post| %> > <%= post.title.class%> > <%= post.tags%> > <%end%> > > it gives as result a blank page, it not even shows which class are those > elements. But still, it doesn't either give errors. > > What I did then was to change the 'tag' action in PostsController in : > > @posts = Post.tagged_with(params[:id]) > > But then I'm wondering if the mistake isn't in the post's index.html.erb > , because this is what I did : > > <% @posts.each do |post| %> > <tr> > <td><%= post.title %></td> > <td><%= post.body %></td> > <td> <% post.tag_list %> > <% b = a.to_a %> > <% b.each do |tag|%> > <%= link_to tag, {:controller => :posts, :action => :tag, :id => tag.id > }%> > <% end%> > > and I did this because otherwise the tag_list would appear as a single > string merged together, even if I use a split method. This works, or at > least it makes the tags appear singularly, but still, when I go to the > url > http://0.0.0.0:3000/posts/tag/#TAG_ID# > I get and empty page, even though the ROUTES.RB has this string > uncommented: > match ':controller(/:action(/:id(.:format)))' >
Sorry but I'm a little confused now on what's happening in your app. Please answer the following questions: 1. is your view for the index and tag actions the same? 2. since you are now using params[:id] instead of params[:name], are you getting the right posts? 3. please post the corresponding routes line that matches /posts/tag/tag_name > > ...no idea :-\ > > -- > 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. > > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.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.