Nested routes allow to capture relationship in your routing.
Questions tagged [nested-routes]
462 questions
0
votes
0 answers
Create and Update Redirect with Nested Resources Rails 4
to avoid deep nesting routes I have done the following:
routes.rb
resources :clients, controller: 'clients' do
resources :sites, controller: 'clients/sites', except: [:index]
end
resources :sites, controller: 'clients/sites', except:…

Shawn Wilson
- 1,311
- 14
- 40
0
votes
1 answer
Rails link_to polymorphic parent, which can have a nested route
I have the Comment model, which is polymorphic associated to commentable models like Project, User, Update etc. And I have a page where a user can see every User's comment. I want a link near each comment with an address of an object this comment is…

Juke Seroon
- 39
- 6
0
votes
1 answer
Rails 4 - routing using concerns
I am trying to figure out how to use concerns in my routes file.
I have models called User, Project and Eoi.
The associations are:
User
has_many :eois
Project
has_many :eois
Eoi
belongs_to :user
belongs_to :project
I am trying to make a system…

Mel
- 2,481
- 26
- 113
- 273
0
votes
2 answers
Rails 4 Nested Routing Back to Parent's Show Page
In my web app I created two Modules; Clients and Workers. My issue is that I can't create a 'Back' link from workers#index to clients#show. In other words, I want to create this in the URL:
http://localhost:3000/clients/1
I believe it has to do…

hp001
- 79
- 10
0
votes
1 answer
UrlGenerationError within Routes
I have a nested route but I am getting the error of missing required keys: [:product_id]. I am passing this via the link_to method though it doesn't appear to be working
No route matches {:action=>"index", :controller=>"admin/merchandise/variants",…

Boss Nass
- 3,384
- 9
- 48
- 90
0
votes
2 answers
Couldn't find Workout without an ID Error With Nested Routes
I have a set of nested routes that look like this:
resources :workouts do
resources :exercises do
resources :reports, shallow: true
end
end
I tried to make them as shallow as possible, but not nesting them simply generated too…

Liz
- 1,369
- 2
- 26
- 61
0
votes
1 answer
rerouting nested resource in Rails
I have this in my routes:
resources :users do
resources :posts
end
It creates the show path /users/:user_id/posts/:post_id
Great. But if someone types /users/:user_id/post/:post_id (mind the singular /post and not /posts) then they get a 404. I…

Ben
- 2,957
- 2
- 27
- 55
0
votes
2 answers
ActionController::UrlGenerationError with :admin namespace and nested resources
Good day StackOverflow,
I have created an admin namespace, and within the namespace I have a client resource and nested in that is a site resource like so:
# routes.rb
namespace :admin do
resouurces :clients do
resources :sites
…

Shawn Wilson
- 1,311
- 14
- 40
0
votes
1 answer
Map one controller action on another action rails
I have a controller named carts_controller and in my routes I am using restful routes i.e., resources :carts.
I know resources create default actions like create, index etc., but if I don't want to user create and create a method add_to_cart and in…

rubhan
- 34
- 6
0
votes
1 answer
Nested Routes Backbone
I'm trying to achieve nested routes with Backbonejs like this:
var Router = Backbone.Router.extend({
routes: {
'(/)': 'root',
'/a/:id: 'loadA,
'/a/:id/:secondId: 'loadA'
}
})
Issue I am facing is that '/a/:id' is…

fran
- 515
- 2
- 11
- 22
0
votes
1 answer
How I get the Railscasts episode "#229: Polling for Changes" to work with a nested route?
I have a rails 3 application very similar to the one in Railscasts episode #229 the only difference is that in my code Articles is called Posts and I have a nested route:
routes.rb:
Myapp::Application.routes.draw do
resources :posts do
…

66tree
- 579
- 7
- 29
0
votes
1 answer
React nested route not mounting
I want my routes to look like:
/
/signin
/discussion/:title
However, anything past the second forward slash causes an error, and all of my client-side dependencies are throwing Unexpected token errors. For instance, reactjs, my CSS, nor my image…

Rashad
- 235
- 4
- 15
0
votes
1 answer
Form Model Binding on Nested Routes - Cannot PATCH - Returns MethodNotAllowedException on RouteCollection on Line 219
I am getting the MethodNotAllowedException error whenever I try to submit a PATCH request to my controller. It only occurs on my nested route, all other routes that run the PATCH request work…

Andrew Fox
- 794
- 4
- 13
- 30
0
votes
1 answer
nested views with backbone routes
i would like to navigate my nested view in backbone app with routes. I have next code:
var StoreRouter = Backbone.Marionette.AppRouter.extend({
appRoutes: {
'item/:name/' : 'showItem',
"item/:name/species/:speciesName/" : "showSpecies"
…

Pavel Poberezhnyi
- 733
- 13
- 28
0
votes
1 answer
Rails, create specific route for each user conversation
I'm trying to create a simple messaging capability for my User in my simple app.
So far, I've created a Message Controller/Model where users can simply message back and forth. User has_many :messages, and Messages belongs_to User.
My Message model…

gitastic
- 516
- 7
- 26