Questions tagged [nested-routes]

Nested routes allow to capture relationship in your routing.

http://guides.rubyonrails.org/routing.html#nested-resources

462 questions
1
vote
1 answer

Angular2: Not able to navigate to child routes directly

I have created routes like this {path: 'trainings', component: TrainingWrapperComponent, children:[ {path: '', component: TrainingsListComponent}, {path: 'createTraining', component: ManageTrainingComponent}, {path: 'trainingLanguage',…
Pratik Barasia
  • 561
  • 1
  • 3
  • 14
1
vote
2 answers

Rails 4 - how to add an edit link for a nested resource

I'm trying to figure out nested routes. I have models called Project and Potential Use. The associations are: Project has_many :potential_uses accepts_nested_attributes_for :potential_uses, reject_if: :all_blank, allow_destroy:…
Mel
  • 2,481
  • 26
  • 113
  • 273
1
vote
1 answer

Aurelia How do I use a Child Router and dynamics child routes

Trying to use a child route in Aurelia. Can't seem to get my head around the workings of nested routes. Are all routes derived from the root of the app or relative to location of the current router? Why wont my route-href work in this example? I…
1
vote
2 answers

Getting the ID of a resource in a nested URL Rails 4

What I'm looking to do is set the "album_id" attribute of my Song instance equal to the ID of the album currently being viewed. For example: http://localhost:3000/artist_profiles/1/albums/2 In the above URL, I would like to set the "album_id" of the…
user3700231
  • 173
  • 2
  • 3
  • 16
1
vote
2 answers

ReactJs cannot acess nested route

I have an issue using nested routes with react-router. Here is my code (two simple react components, routes file to access comp1/comp2) : House.js export default connect(st => st)(class House extends React.Component { render() { return (
Gulle
  • 23
  • 5
1
vote
2 answers

Error when trying get index of list nested route Rails "unexpected tIVAR"

I want to get a list of all the reviews that belong to a, which belongs a category. I'm getting an error when trying to get a list of all the reviews in a JSON file (it's a API application):…
Samuel
  • 513
  • 3
  • 17
1
vote
1 answer

Routes Increment when I Run Rspec feature

So, for some reason my routes increment by 11 when I run my comment feature test. Exhibit A: I hit save on my comment_spec.rb RSpec.feature "Adding comments to movies" do before do @kyle = Admin.create(email: "kyle@example.com", password:…
kyle
  • 207
  • 3
  • 17
1
vote
0 answers

Can we make nested routes better in Laravel 5.2?

I have deeply nested routes in my Laravel5.2 app like so: country country.state country.state.county country.state.county.city country.state.county.city.child country.state.county.city.child.status this forces me to include ids of all the parents…
Junaid Qadir Shekhanzai
  • 1,386
  • 1
  • 20
  • 38
1
vote
0 answers

Trouble with accessing controller action within nested route with RSpec

I'm working with the following route: resources :groups, :only => [:show, :create, :update, :destroy] do get 'viewmembers' => 'groups#view_members" end But when I'm trying to test in RSpec: describe "GET #viewmembers" do context "the group…
Riptyde4
  • 5,134
  • 8
  • 30
  • 57
1
vote
1 answer

Help convert a nested route to Rails 3

I have a comment form (in comments/_form.html.erb) that I use in my other controllers (posts and tags). <% form_for([@post, Comment.new], :html => { :multipart => true }) do |f| %> <%= f.text_field :commenter %> <%= f.text_field :email…
66tree
  • 579
  • 7
  • 29
1
vote
1 answer

Descriptive URL, different pages, but same controller ( domain.com/cars/wheels)

Custom routes for the same controller. I have many semi-static pages in my app (actually stored in my database with a group and page name field), they are grouped by product and then subject, for example Cars: tires, Wheels, Radio, Windshield Homes:…
user2012677
  • 5,465
  • 6
  • 51
  • 113
1
vote
1 answer

Rails JQUERY Toggle with Nested Resources

I'm trying to figure out how to toggle a "finish" action with nested resources in rails. For whatever reason I can't get it to do what I want. I keep getting 'Couldn't find List without an ID'. Which makes sense but I can't configure it so that it…
Mark Hustad
  • 169
  • 1
  • 14
1
vote
2 answers

ActionController::Routing Error (Nested Resources - Rails 4 Ruby 2)

I am attempting to nest resources in such away that i can avoid nesting a resource 3 deep. my original plan was to do something like: (just so you can see my thought process) resources :properties do resources :stalls do resources…
Shawn Wilson
  • 1,311
  • 14
  • 40
1
vote
1 answer

ActiveRecord::AssociationTypeMismatch In Nested Route

Application Details: Rails 4 Ruby 2 I have a nested relationship, Stalls and Reservations. when I try to create a new reservation from stalls I get the following error: ActiveRecord::AssociationTypeMismatch Stall(#70127041150600) expected, got…
1
vote
2 answers

Rails restful namespaces, resources... newbie question

I'm attempting to use nested controllers that have restful pathing, so that I'm all organized and such. Here's a copy of my routes.rb so far: map.root :controller => "dashboard" map.namespace :tracking do |tracking| tracking.resources…
Dan
  • 199
  • 3
  • 12