Question

I have my index page which posts a single entry instead of the usual scaffold default of all of the entries. I told it to link to an action and it just responds to "Couldn't find Post with ID=all". It is the same as the default index method and index view. I assume this has something to do with routing but being no I have no clue. Any ideas?

Was it helpful?

Solution

The "all" name is misleading. If you want a page to display all the posts then the index page is perfect for that. If you want to show a subset of the posts then I recommend adding another action to your controller with a better name and then this to the routes.rb file:

map.resources :posts, :collection => { :some => :get }

Which you then can reference by using some_posts_path or some_posts_url.

For more information read the Official Ruby on Rails Routing guide.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top