Nested routes allow to capture relationship in your routing.
Questions tagged [nested-routes]
462 questions
-1
votes
1 answer
How to create a route under a nested resource and namespace in rails?
I'm trying to create the below route but I am running into a "routing error" of "uninitialized constant Foo::Bar::Biz"
/foo/bar/biz//custom
My routes file is as follows:
namespace(:foo) do
namespace(:bar) do
resources(:biz, only:…

Peck3277
- 1,383
- 8
- 22
- 46
-1
votes
1 answer
Customize nested routes for a cleaner URL in Rails?
I am working on a website and I am trying to change how the URL looks for the users.
As I have all my resources nested, I struggle a lot to do what I want.
At the moment, here are my routes
resources :folders do
resources :portfolio_photos
…

Jessicascn
- 151
- 1
- 13
-1
votes
1 answer
Rails 4 - nested resource under singleton resource
I have a Rails 4 app and currently implementing a shopping cart.
i dont want to reveal the user id, cart id but only the cart items id in the url.
so basically, i want my routes to be something like ;-
/user/cart/plans => show all…

Milind
- 4,535
- 2
- 26
- 58
-1
votes
1 answer
Rails routing - First argument in form cannot contain nil or be empty
I have a rails app with a Listing model which has_many Courses which has_many Course_photos.
The rails route for loading new course_photos is "listing_course_photos" or /listings/:listing_id/courses/:id/course_photos(.:format)
In trying to load…

Jack Riminton
- 130
- 1
- 8
-1
votes
2 answers
How do I change to use the same route :id as update instead of :model_id?
I have these routes
resources :brokers do
patch :approve
rake routes
broker_approve PATCH /brokers/:broker_id/approve(.:format) brokers#approve
PATCH /brokers/:id(.:format) …

Chloe
- 25,162
- 40
- 190
- 357
-1
votes
1 answer
REST API - How to get parameters from main route to nested one?
I'm working on a rest api in which I'm using middlewares and trying to set nested routes.
i got something like this:
router.use('/route/:param/day, router1);
router.use('/route/:param/year, router2);
router1.get('/:day/:month/:year', function(req,…

Tommy
- 21
- 2
-1
votes
1 answer
Cannot use nested routes create
Struggling to get the create working for my nested routes in the following controller:
class BooksController < ApplicationController
before_action :set_book, only: [:show, :edit, :update, :destroy]
before_filter :load_author
# GET /books
#…

NickP
- 1,354
- 1
- 21
- 51
-1
votes
2 answers
Rails routing with a has many through relationship, no id
So I have a bands table, a festivals table and a bands_festivals table. I am having trouble accesing the show page of the bands_festivals table.
This is my routes file:
Ejemplo::Application.routes.draw do
resources :bands_festivals
resources…

Zumwan
- 1
- 1
- 4
-2
votes
1 answer
Laravel can't find the second passed parameter
I'm passing two parameters to my ShopController. one is a lang parameter that is in a route group as a prefix for all routes and the second one is a slug passed through a link.
Here's my controller:
function show($lang, $slug)
{
$product =…

Eric SsSnake
- 25
- 8
-2
votes
1 answer
Can Ruby on Rails Routes point a nested URL at a single action?
Is it possible in Ruby on Rails (we're using v2 still) to allow the routes file to map a nested url EG
mydomain.com/controller/object/action
to a single action eg
:controller, :action
?
We currently have a url like
mydomain.com/controller/action…

xiatica
- 1,546
- 2
- 20
- 24
-2
votes
1 answer
Understanding nested routes
In Rails would it be correct that where ever two tables are connected in a 1:M relationship there should be a corresponding nested route in the routes config file?

Dercni
- 1,216
- 3
- 18
- 38
-3
votes
1 answer
Angular 2 parent's path replaced with child's path
This is my current routes config of latest version Angular app
const routes = [
{ path: 'board', component: BoardComponent, canActivate: [AuthGuard], children: [
{ path: 'stories', component: StoryComponent }]},
{ path: '**', redirectTo:…

Louen Leoncoeur
- 25
- 6