Nested routes allow to capture relationship in your routing.
Questions tagged [nested-routes]
462 questions
0
votes
2 answers
No route matches [GET] for an update that should be [PUT]?
I'm trying to process an update on a comment. Now I'm pretty sure this should be a PUT request however I seem to be getting a GET command like so:
No route matches [GET] "/books/10/snippets/24"
Here is my controller for snippets:
class…

Shaun Frost Duke Jackson
- 1,256
- 1
- 10
- 22
0
votes
1 answer
After Create redirect to other controller Edit
When a User create a new account on my app, I want to redirect him to another controller, lets say, a preferences controller.
But I don't know how to do it, the user is created, but it is not been redirect to the new page
Here is the create from…

Eduardo Almeida
- 410
- 4
- 26
0
votes
2 answers
Class scope gets lost somewhere between 3 level deep controllers (rails)
I have 3 levels of controllers, because I otherwise would have to face a lot of duplication. The 1st level then inherits from InheritedResources::Base in the gem inherited_resources. Somewhere between the controller files I loose the scope.
First…

JohnSmith1976
- 536
- 2
- 12
- 35
0
votes
1 answer
having trouble getting form to submit to the correct route
When submitting my form (_reply_form.html.erb) I get this error:
Routing Error
No route matches [POST] "/responses/replies/4"
Try running rake routes for more information on available routes.
This is how my architecture is set up: Offering has…

Pavan Katepalli
- 2,372
- 4
- 29
- 52
0
votes
3 answers
Creating new child in nested routes
This one is driving me crazy. I've got a nested relationship between two models in my project, and I decided I did not want it to be shallow, since the child object (years) has no meaning outside the context of the parent (festivals).
So I sort of…

monkeyangst
- 1
- 1
0
votes
1 answer
Ember and Rails One to Many Relationships
I've been trying to render data in the same view and cant seem to get something right. I want to be able to render the rating for each location on the locations show outlet.
Here's what I have got.
I've tried different routes and different nesting…

Garrett Boone
- 234
- 3
- 12
0
votes
1 answer
Creating a general index when using nested routes
I am new to rails, and for the first time I am working with pgsql. The way my project is set up it requires that a song cannot be created with out an artist. To accomplish this I used nested routes so the id persists. My problem is that I am trying…

Jude Igboanugo
- 1
- 2
0
votes
1 answer
Working with nested resources
Imagine this. I'm on the URL http://localhost:3000/companies/3, and on this view, I want an employees button that takes me to http://localhost:3000/companies/3/employees
In my routes file, I have
namespace :companies, :only => [:index, :show,…

Mike
- 159
- 3
- 13
0
votes
1 answer
Rails4 route with scope and namespace
quite new to Ruby and Rails, so it's probably a dumb question ;)
I try to get a "i18n" route working with an "admin" namespace.
So, my routes file looks like
scope '/:locale' do
root 'admin#index', as: :root
namespace :admin do
resources…

bmichotte
- 590
- 4
- 15
0
votes
2 answers
Rails: Shallow route name with custom behaviour
Let's say I have two models (Model1 and Model2) that share the same controller, both have many instances of Model3.
How can I achieve to nest Model 3 within both models and have the route: model_3_path(@model) instead of model_1_model_3_path(@model)…

Danyel
- 2,180
- 18
- 32
0
votes
1 answer
Combine 2 paths
I'm new to rails and i'm sure this is a simple question but I haven't been able to find it. I have a product model and a sku model. A product has_many skus. I have a route setup to use a path like this: /products/1/skus/3
What I'm trying to figure…

Eric Norcross
- 4,177
- 4
- 28
- 53
0
votes
2 answers
How to handle nested resources/routes correctly?
I am trying to build a Rails app modded from Michael Hartl's Railstutorial. The code is located on GitHub.
I am using the following nested resources:
resources :users do
resources :scaffolds
end
But I am getting the following…

maasha
- 1,926
- 3
- 25
- 45
0
votes
1 answer
Routing error on response_with with model name
I have an annoying issue with this particular situation:
#Controller> api/albums_controller.rb
class Api::AlbumsController < ApplicationController
respond_to :json
def create
respond_with Album.create(params[:album])
end
end
As you can…

diegocst90
- 61
- 7
0
votes
0 answers
creating new item using polymorphic paths with nested associations
I want to be able to write a review for the two models separately (using polymorphic paths with nested associations). At the moment, I have a problem in that if I want to write a review for the city, then the record is created for the country, not…

nilid
- 372
- 2
- 12
0
votes
3 answers
What objects should be passed to a link_to with triple nested route?
What objects should I pass to my link_to for a triple nested route? I want to retrieve the exercise show page.
show.html.erb - workouts
<%= link_to exercise.name, plan_workout_exercise_path(???) %>
routes.rb
resources :plans do
resources :workouts…

neverbendeasy
- 968
- 10
- 17