Ruby on Rails Friday, September 2, 2011



On Fri, Sep 2, 2011 at 6:15 PM, Leo M. <lists@ruby-forum.com> wrote:
1. Nope. There's the main index:
   0.0.0.0:3000/posts #which is placed in =>
/views/posts/index.html.erb

  and there's the tag action:
  0.0.0.0:3000/posts/tag/TAG_NAME #which is placed in
/views/posts/tag.html.erb


what i'm asking is if they have the same code.
 
2. Nope. But I didn't get the right post neither before. Changing from
(params[:name]) to (params[:id]) didn't change big things. Even though
the url 0.0.0.0:3000/posts/tag/TAG_NAME or also
0.0.0.0:3000/posts/tag/TAG_ID are recognized and loaded, they don't
display the relatives posts.


can you put a debugger inside the tag action and paste the output of params.inspect
 
3. In routes.rb there's this line that should be sufficient as
instruction, but maybe I'm missing something :
  resources :posts
  match ':controller(/:action(/:id(.:format)))'


so the route that matches the url is the last one, so params[:id] should have the tag name
in the tag action.  are you sure you have posts in your database that are properly tagged?
 
Thanks for your help!

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

No comments:

Post a Comment