Not sure from your question, you seem to be asking "How do I sort the 
Categories index?" but you've provided a link_to that deals with a single 
Category. Typically, you'ld order your Categories in the controller index 
method and the ordered list would be available in the index.html.erb view 
as @categories. You could then step through this list in your view with 
@catagories.each do |category|.

If that's what you've done then "category" (in your link_to) should be the 
id of a single category.

At any rate, you would really help yourself by getting familiar with the 
Rails Guides at http:guides.rubyonrails.org.


On Tuesday, March 4, 2014 5:25:54 AM UTC-5, Steven Cahill wrote:
>
> Hello Everybody
>
> I have a navigation that draws data from a category table, I would like to 
> display the navigation by category ID order, this is the code I have so far
>
> <%= link_to category.title, category_path(category) %> in the view
>
> not sure where to go next to get order by category id
>
> Steven
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/f8397571-a06a-4a16-92c1-570b200cadd5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to