Nested resources

I have nested resources but each resource included has_many pictures,
how
do i add the pictures resource to my routes.rb Should it just be
“resources: :pictures” with no nesting?

On Jan 21, 2016, at 4:24 AM, fugee ohu [email protected] wrote:

I have nested resources but each resource included has_many pictures, how do i
add the pictures resource to my routes.rb Should it just be “resources: :pictures”
with no nesting?

What do you want your URLs to look like? That’s the only thing that
matters in the routes file. Are the pictures only accessible through
their parent record? Or is that just a convenience method that you use
in a few routes, like a list of all pictures in an Article for the admin
view? The relationship between parent and children matters to the model,
but is not the driving force when designing your URLs.

Walter

Thanks, Walter Lee D., I used pictures in my routes then Pictures can
only be added as children of parent objects ~ fugee lee ohu

On 21 January 2016 at 17:16, fugee ohu [email protected] wrote:

Thanks, Walter Lee D., I used pictures in my routes then Pictures can
only be added as children of parent objects ~ fugee lee ohu

Remember that you can have as many routes as you like, so you can add
other routes (for the same resources) for other purposes if you want.
It is entirely up to you how you format the routes.

Colin

Thanks Colin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs