Hi all
I'm quite new to RESTful Rails and tried a bit with a new app, but it seems I don't comprehend something yet.
I have the following two models:
class CompactDisc < ActiveRecord::Base belongs_to :genre validates_presence_of :genre end
class Genre < ActiveRecord::Base has_many :compact_discs end
In routes.rb I have the following route:
ActionController::Routing::Routes.draw do |map| map.resources :compact_discs
map.resources :genres do |genre| genre.resources :compact_discs, :name_prefix => 'genre_' end
... end
When opening localhost:3000/compact_discs it shows me all CD's. When opening localhost:3000/genres/1/compact_discs it still shows me all CD's! Shouldn't it only display the ones that are associated to genre 1 now? Or did I miss something?
I also played with
map.resources :genres, :has_many => :compact_discs
but this didn't help me neither...
Thanks for help Josh