Marnen Laibow-Koser wrote: >> so we might have >> domain/:domain_id/plot or domain/:domain_id/report -- is this what you >> meant? > > Yes > ... > Domains belong to users, but since the domain already knows whom it > belongs to, there's usually no reason to put that information in the > path and make longer URLs.
Hey Marnen: I'm game, so I've been trying what you recommended. I've stripped out plots and reports just to understand the basics, so my route.rb looks like: ActionController::Routing::Routes.draw do |map| map.resources :users map.resources :locations end I can create, view, edit, delete Users without trouble. But I'm conceptually stuck on how to create Locations. Since Users has_many Locations, I need to stuff the user_id into a Location when I create it. My location_controller code for create() is something like: def create Rails.logger.debug("#{self}.create(): params = #{params}") @user = User.find(params[:user_id]) # THIS LINE FAILS: no :user_id present @location = @user.locations.build(params[:location]) if @location.save flash[:notice] = 'Location was successfully created.' format.html { redirect_to(@location) } else format.html { render :action => "new" } end end This code fails because no params[:user_id] is define when coming in via POST, and I don't see where to pick up the :user_id. Inasmuch as you're advocating flat routes, you must know some trick that I'm overlooking. (Pardon if this is garbled -- it's late and I've been wrestling with this for a while.) What am I missing? Best, - ff -- Posted via http://www.ruby-forum.com/. -- 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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.