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

Creating link_to for sequential nested resources

I am creating a rails app whereby from a record's "show" page, the user is able to cycle through the record's nested resources (similar to a slideshow). For example, from the "show" page, the user will be able to link to the "show" for the first…
dsteinbr1
  • 77
  • 11
0
votes
2 answers

Nested resources / pundit - param is missing or the value is empty:

I've been on a big trouble for 2 days and need you help !! I have 2 models : garden and booking (with nested resources and using pundit). From the "show" of garden, I want to click on a button that "create"s the booking directly from the already…
0
votes
1 answer

Obtaining nested resource id form URL

I have made a nested resources (as below). While being on a coffee_profile#show view, create a specific recipe for that one particular profile via link (/coffee_profiles/:coffee_profile_id/recipes/new(.:format)). resources :coffee_profiles do …
szoroh
  • 3
  • 3
0
votes
1 answer

Adding Nested Resources to Search Results

I am creating a rails app where I have implemented the following search function. application.html.erb
dsteinbr1
  • 77
  • 11
0
votes
2 answers

rails: nested resources saving empty records

I have created a simple form of nested resources. I can't get the child form todo_item to save correctly. When I click the "create todo item" button, an empty record will be created and saved no matter what I put in the title field. The code is…
user2597183
  • 29
  • 1
  • 1
  • 8
0
votes
1 answer

rails nested resources no route matches missing required key [:id]

I have a very simple case of nested resources but I am having trouble to get them to work. My models: class TodoList < ActiveRecord::Base has_many :todo_items, dependent: :destroy class TodoItem < ActiveRecord::Base belongs_to…
user2597183
  • 29
  • 1
  • 1
  • 8
0
votes
2 answers

Summit button not working in rails form_with edit action

I have created a form to edit a nested resource within a rails application. The form renders properly and the submit button works with the form for the create action but causes noting to happen in when applied to the edit action. No error is…
dsteinbr1
  • 77
  • 11
0
votes
1 answer

Unable to render a nested resource's errors on parent resource show page

I have a basic "blog" application with posts and comments. I'd like to allow users to comment on a post from post#show and I'm not exactly sure how to present comment validation errors on the post. The code below nests comments under posts and…
Billy Blob Snortin
  • 1,101
  • 3
  • 11
  • 17
0
votes
1 answer

RecordNotFound in Controller#edit

I am attempting to create an edit action in a controller for a nested resource. When I attempt to run the Edit action, I receive the following Error: ActiveRecord::RecordNotFound in IngredientsController#edit Couldn't find Recipe with…
dsteinbr1
  • 77
  • 11
0
votes
1 answer

Can I create a form for a nested resource without the parent record until I save?

I have two models Player and MicroReport. MicroReport is a nested resource of Player. I'm trying to create a separate form to allow users to create a MicroReport without having to first navigate to a Player's page and then create the report. Is…
daveomcd
  • 6,367
  • 14
  • 83
  • 137
0
votes
1 answer

Why is my nested resource form trying to use a non-existent path method when I've already set the URL?

I have the following routes defined in my application: resources :users do resources :data_sets end The form data_sets/new is accessed from the following link: <%= link_to "New Data Set", new_user_data_set_path(user) %> The form is defined as…
Jared
  • 4,240
  • 4
  • 22
  • 27
0
votes
0 answers

No route matches {:action=>"index", :controller=>"admin/genius"}, missing required keys: [:cohort_id]

I have an activeadmin rails 5 app that I am getting a no routes match error even though the routes are shown. Rails Routes new_admin_cohort GET /admin/cohorts/new(.:format) admin/cohorts#new …
0
votes
1 answer

Rails nested resource routing error

I have a routing error with a nested resource. Here is my nested routing: resources :users do resources :pages end This is my minitest "visit new user page" system test: test "visit new user page path" do user = User.create visit…
Randall Blake
  • 684
  • 2
  • 6
  • 15
0
votes
1 answer

Rails 5.1, sum by currency with nested resources

I have a problem with a SUM calculation. I have multiple currency in a table, I have users, I have groups and I have a bets table. The user can join a group via member (user_id and group_id). And the user can share his bet via groupbet (bet_id and…
Asso
  • 53
  • 1
  • 7
0
votes
1 answer

Create new company no longer works due to nested routes

My app has a Company model and User models, I've been working on the path/url structure and have managed to get it working how I wish using nested resources as shown in the code below. I've used FriendlyID to added company_names and usernames to…