Questions tagged [nested-resources]

In REST, nested resource is a web resource composing another. Its reference is built over the reference of another web resource.

Definition

In REST-style architecture , a resource is simply a source of information, the one you want to expose. The resource is referenced by a global identifier such as an URI. When you deal with information structure such as composition, you’ll use nested resources. The reference of the embedded resource is then built over the reference of the composite resource.

For instance, a blog post http://example.com/posts/1 owns several comments http://example.com/posts/1/comments.

374 questions
0
votes
1 answer

Ruby on Rails - Custom routing for review resource with index / show page and pagination

I'm stuck on a very tricky issue involving Rails 3 routes, and not good enough with routes to figure this one out on my own. I have a "Reviews" resource with only a "Show" and "Index" action. I am using the Friendly ID gem for slugged IDs, and I…
Shannon
  • 2,744
  • 3
  • 28
  • 37
0
votes
3 answers

What are nested resources and where do they come from?

for my thesis I need a precise definition of sub-resources (or nested resources). I read Fieldings Disseration and he indeed introduced the terms resource and resource identifier but he did not introduce the term sub-resource. This is an example of…
Amit
  • 126
  • 2
  • 10
0
votes
0 answers

how to preload posts like instagram feed

Im using recyclerview in my app but the problem with it, is it looks not so good as if we scroll the images or videos take time and the viewholder stretches. What i want to do is load the upcoming posts before user gets to them and if user scrolls…
0
votes
0 answers

Multi-Step Form debugging Rails - ActionController::ParameterMissing

I understand that this issue has been raised several times, but I can't find to find a way around.. I am using this solution to create a multi-step form without the Wicked gem: Best way to make Multi-Steps form in Rails 5 It seems that I am able to…
0
votes
1 answer

Users and nested (yet potentially independent) "groups" in Rails 3?

I'm having a bit of trouble wrapping my head around something. Basically I'm starting a new project that involves groups of groups of groups of groups of…well, you get the idea. Anyway, the only model that is somewhat "universal" throughout the…
humble_coder
  • 2,777
  • 7
  • 34
  • 46
0
votes
2 answers

Rails – Nested Resource - My edit and delete methods retrieve the wrong IDs

Thank you for taking the time to review this question. I have a nested resource called templates, which belong to categories. I have the template create, edit and delete actions displayed in the Category Show page. I am able to create with no…
Maisuls
  • 1
  • 3
0
votes
3 answers

.each Statement Based on Nested Resources

I am trying to write an .each statement based on the characteristic of a nested resource. The relationships between tables in my app are defined as below: User has_many Posts Post belongs_to User Post belongs_to Category Category has_many…
0
votes
2 answers

No Route error when passing parameters through link_to

Error: No route matches {:action=>"new", :controller=>"comments", :parent_id=>1} routes.rb: MyApp::Application.routes.draw do resources :posts do resources :comments end resources :topics do resources :posts end root :to =>…
BasicObject
  • 765
  • 1
  • 5
  • 23
0
votes
1 answer

Trouble with multiple resources on creating message board

I'm working on a message board for my application and it has the typical three resources to make it all work: Forums, Topics and Posts. The routes are defined as so: resources :forums do resources :topics do resources :posts …
Shannon
  • 2,744
  • 3
  • 28
  • 37
0
votes
1 answer

Railstutorial.org book, changing to nested routes

Hi I've been following along in the Rails Tutorial book, creating users and posts and a feed to show the posts. However, the author never used nested resources, which seem to be very important in rails and I would like to discover how to use them…
trying_hal9000
  • 4,343
  • 8
  • 43
  • 62
0
votes
0 answers

is it the best approach to make nested rest api calls in iteration?

I am consuming web-service in my spring boot application.I need to fetch information from apis. This information can be fetched by calling different nested apis: getAllColleges - gives ids of all colleges /college/{id}/departments - gives id of…
Manish
  • 1,274
  • 3
  • 22
  • 59
0
votes
1 answer

Search for a nested resource

I have an event with many guests for that event. A guest must search themselves using their ID to RSVP but I cannot get the search to return that guests info (show/edit page). The search tag:

Enter your ID here:

<%= form_for "",…
0
votes
2 answers

How to define a controller function that works for instances of any model

Implementing versioning for a Rails app I'd like to have a view that displays all versions of a model with some extra functionality like reverting etc. I use the paper_trail gem for the versioning. I know that I could do that by writing a controller…
Martin Klepsch
  • 1,875
  • 3
  • 18
  • 24
0
votes
2 answers

Having trouble submitting nested resource through form [Rails 5]

I have a Document that has_many Section, and each section has_one Comment. I want to be able to create both sections and comments in the Document show view, but I'm having trouble getting comments to go through. Here's the relevant code with the…
San Diago
  • 1,030
  • 1
  • 12
  • 26
0
votes
0 answers

Laravel 5.7 - How to access pivot table in nested API resource?

My DB scheme among others includes the pivot table: user_workshop - id - user_id - workshop_id - accepted_at - rejected_at // other fields... with the respective models User & Workshop and the belongsToMany relationships in each. Trying to access…
achariso
  • 1
  • 1
  • 1