You need to mention :on => :collection on the route.

get '/foodsIlike/user_list' => 'foodsIlike#user_list', :as => 'user_list',
:on => :collection

On Tue, Oct 28, 2014 at 6:47 AM, Sonali Katara <[email protected]>
wrote:

>  I have a single table in which I store favourite dishes of users. A user
> can have more than one entries in the table. I have generated a view to
> show all the entries in the table but how do I create a view to show just
> the list of users. I don't have a table saving the users so I have to use
> DISTINCT to get the names of the users from my one and only table
>
> I appraoched this by creating a new route
> /foodsIlike/user_list
>
> get '/foodsIlike/user_list' => 'foodsIlike#user_list', :as => 'user_list'
>
> instead of going to the user_list it tries to find a record with
> :id=user_list as that is what it would do to show one record
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rubyonrails-talk/a0639623-2ef0-468b-bc7d-7856f1e1c12c%40googlegroups.com
> <https://groups.google.com/d/msgid/rubyonrails-talk/a0639623-2ef0-468b-bc7d-7856f1e1c12c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CAFKVRj95U_XwjRkPT0rinXKVxsfV%2BUMqsb%3DCMNywOkmHpKfRLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to