Nested routes allow to capture relationship in your routing.
Questions tagged [nested-routes]
462 questions
1
vote
1 answer
Nested routes and CRUD operations with additional values for assciation in Rails
I created one has_many through relationship in rails api. I also used nested routes.
My models like below;
class Author < ActiveRecord::Base
has_many :comments
has_many :posts, :through => :comments
end
class Post < ActiveRecord::Base
has_many…

Akhil
- 1,918
- 5
- 30
- 74
1
vote
1 answer
Ruby On Rails and Routes file structure
I am wondering if the following is acceptable structure for the routes in the route file. I have not seen an example of it being done exactly this way, however it does seem logical. If it is not please let me know why.
Rails.application.routes.draw…

The Gugaru
- 618
- 6
- 23
1
vote
2 answers
angular ui route nested
Hi I'm trying to create a nested route inside an already nested route. In synthesis, I have a portal which contains my sidebar and some other fancy stuff and there I can navigate to clusters. From clusters I should be able to select one cluster and…

anram88
- 11
- 1
1
vote
1 answer
How to make parameters optional when using Rails named routes?
I have a named route:
map.find '/find/:category/:state/:search_term/:permalink', :search_term=>nil, :controller=>'find', :action=>'show_match'
and the following URL matches it & works…

Jason
- 22,645
- 5
- 29
- 51
1
vote
1 answer
Rails Nested Resources with :member
I've got something like this in my routes.rb:
map.resources :retailers, :has_one => [:invite_code]
map.resources :invite_codes, :member => {:redeem => :get}
and it isn't generating a route that I would…

Nick Stamas
- 1,801
- 1
- 16
- 19
1
vote
2 answers
Rails 4.1 nested routes redirect_to test won't pass
Just getting comfortable with Rails but this one has stumped me. Thanks for the help!
Here is the current failing test.
Failures:
1) SectionsController POST #create with valid attributes redirects to course_section_path
Failure/Error:…

Jacksonvoice
- 93
- 10
1
vote
1 answer
simple_form is giving error undefined method `reviews_path' for #<# for nested route in Rails 4
I checked the other simple_form posts and they didn't quite hit on my problem. I have a nested resource for restaurant reviews in my routes.rb here:
Rails.application.routes.draw do
devise_for :users
resources :restaurants do
resources…

Jason Rodriguez
- 183
- 1
- 1
- 13
1
vote
1 answer
rails 4 child action fails while called from parent view
Error: "Param is missing or the value is empty :child"
I've nested objects (child controler & viewers are in Parent folder). On parent detail page I list all children in a table. Other methods like edit, update, new work. But I want to have a link…

Katarzyna
- 1,712
- 2
- 11
- 14
1
vote
1 answer
Rails Many to Many Relationship with occasional Nested Routes
As I am learning more about rails, and breaking my design thinking from ASP.Net days, I was considering a scenario this morning but did not know if it was possible to do.
Practitioners have many Treatments through services - and vice versa
In my…

the-undefined
- 753
- 1
- 6
- 18
1
vote
1 answer
AngularJS UI Router shared nested routes/states
I'm looking to share a child state between multiple states.
For example I have a shopping site.
Lets say I have the following
.com/random
.com/browse
.com/browse/product/:productID
.com/browse/:search/product/:productID
however I also have a…

Jegsar
- 501
- 6
- 22
1
vote
1 answer
Create relative ids for nested routes
I'm attempting to create what is essentially a second id column for a nested route in Rails.
I have a route that looks something like this: /projects/:project_id/bugs/:bug_id.
Projects have a has_many :bugs relationship and a bug belongs_to…

Scott Mielcarski
- 760
- 6
- 17
1
vote
1 answer
Access other actions from a different controller Rails 4.0
I have a rails app with a route that is:
resources :users do
resources :api_keys
end
now I have the controllers and models and all tests are passing - but I would like a signed in user to go to their personal development centre, so I…

TheWebs
- 12,470
- 30
- 107
- 211
1
vote
0 answers
nesting comments resources in posts resources
I'm doing the RoR tutorial on rubyonrails.org and have been doing fine up until adding comments to posts.
When I click through to 'show' a post, I get the following error:
ActionController::UrlGenerationError in Posts#show
No route matches…

David
- 51
- 7
1
vote
1 answer
Single Table Inheritance(STI) with Single Controller and Nested Resources: polymorphic_path doesn't match route-generated path
So that's a mouthful.
Let's assume that you're a vehicle manufacturer and you want a webapp for stuff. Part of that webapp is used for your designers to collaborate on their designs. You design cars, trucks, and suv's let's say. Let's say you…

Leanan
- 732
- 7
- 13
1
vote
1 answer
Rails routes inside resources :blah do
So far my routes.rb file looks something like this:
resources :games do
resources :planets do
member do
get 'index' as: :play_game
end
end
end
which creates these (when I check rake routes)
play_game_game_planet GET …

Tom Prats
- 7,364
- 9
- 47
- 77