Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deeply nested RESTful resources in Rails

I have this structure in my app:

USER has_one :publicprofile, :privateprofile

PUBLICPROFILE has many :emails, :phonenumbers

PRIVATEPROFILE has many :adresses, :creditcards

I would like to know how to go about having a profile page for the user where I can update his nested resources (and do it in a RESTful way). I couldn't find any docs/examples on the subject (because of that confusing has_one relation).

like image 558
Cezar Halmagean Avatar asked Dec 31 '22 07:12

Cezar Halmagean


1 Answers

I believe any nesting deeper than 1-level is generally frowned upon, and can normally be avoided. Jamis Buck blogged about it a while back.

The PeepCode REST for Rails 2 screencast is quite good too, but it doesn't go extensively into nesting, just resources in general.

like image 61
James Gregory Avatar answered Jan 14 '23 08:01

James Gregory