Hi!
I'm very new to rails and try to set up a simple app with artists and
their songs, for learning.
I have nested routes for some actions to get urls like example.com/
ackord/artistname/songname
And I also have some non-nested routes. It looks like this:
resources :artists, :path => "ackord" do
resources :songs, :path => "", :only =>
[:index, :edit, :show, :update]
end
resources :songs, :only => [:new, :create, :destroy]
match "skicka-in-analys" => "songs#new", :as => :new_song
So far so good!
Now I want to create a list of, say, the 30 latest songs added to my
site. I'm trying to be restful and not add new actions, so how do I
achieve this? It is a index action but with some extra filters
like ...limit(30) and order("created_at DESC") and so on.
This action won't depend on the artist though and therefor shouldn't
be nested inside the artists. Since my regular index action IS nested
with artists I have all these @artist variables in my view which gives
me errors, of course.
So, how do I achieve what I want? Special action or not?
A kick in the right direction would be awesome. I want to learn "the
right way" from the beginning.
Best Regards
Linus
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.