Nested routes allow to capture relationship in your routing.
Questions tagged [nested-routes]
462 questions
0
votes
0 answers
Rails nested routes error for show
EDIT 3:
I have a nested setup for users and document with devise used for authentication on users
when I trie to access a link I create through this method an error accours which points me to the controller get_document method with a…

Filip
- 118
- 1
- 1
- 8
0
votes
1 answer
nested resources with form_for losing first id
This is a strange error that has really got me bugged. First, some background.
I have the following nested resources in my config/routes.rb:
scope :requirements => { :protocol => 'https' } do
resource :user
resources :orgs do
…

Owen Godfrey
- 3,361
- 2
- 22
- 18
0
votes
1 answer
Rails Nested routes with ajax
Let's say I have a URL like this:
http://domain.com/projects/14/phases/30
But I'm loading the phases#show action into a div on my projects#show view via :remote => true links.
I would a user to be able to visit…

nathan
- 514
- 1
- 7
- 20
0
votes
1 answer
Routing error in Rails 3
I have the following in my view (index.html.erb) code:
<% @projects.each do |project| %>
<%= link_to (@project) do %>
...Some HTML here...
<% end %>
<% end %>
The goal is to have each project's…
Matteo
- 1,136
- 1
- 16
- 36
0
votes
2 answers
short nested rails routes
I have routes such as:
somedomain.com/cities/prague/places/astronomical-clock
resources :cities do
resources :places
resources :images
end
I know I can do something like:
match '/:id' => 'cities#show', :as => 'short_city' #…

ere
- 1,739
- 3
- 19
- 41
0
votes
1 answer
Ruby on Rails 3 nested routes: wrong action route
I have two models: team and project
routes.rb
resources :teams do
resource :projects
end
And two questions!
1- According to http://guides.rubyonrails.org/routing.html, I expect to get teams/:team_id/projects/:id path. However, this is not the…

PeaceDefener
- 618
- 2
- 8
- 22
0
votes
1 answer
How can I route a nested resource to an alias?
I know it's not advised to go more then 1 level deep in nested routes but here's what I have:
resources :partners do
resources :recommend_partners do
resources :rec_partner_comments
end
end
Is there a way that I can call an alias…

Breno
- 5,952
- 1
- 20
- 25
0
votes
1 answer
Nested Resources With Form For Gives: wrong number of arguments (1 for 0)
I'm trying to create an edit page for a nested route.
The url is something like: http://localhost:3000/clients/2/notes/3/edit
my routes.rb:
resources :clients do
resources :notes
end
In my edit controller:
def edit
@note =…

Noah Clark
- 8,101
- 14
- 74
- 116
0
votes
4 answers
Rails route for nested model
I have a rails model that is nested:
# app/models/frontend/item.rb
class Frontend::Item < Item
end
When I call
form_for(@frontend_item)
It tries to go to the '/frontend/items' path.
Is there a way to make it go to '/items' instead (without the…

Boris
- 3,163
- 5
- 37
- 46
0
votes
1 answer
Rails3 nested routes with default base
From the example in rails guides, routes like:
resources :publishers do
resources :magazines do
resources :photos
end
end
Will lead to, URLs like:
/publishers/1/magazines/2/photos/3
I want to have slugs for publishers for example -…

whizcreed
- 2,700
- 3
- 22
- 35
0
votes
2 answers
Adding a route for a controller action
I am implementing a like system in my rails app using David Celis gem called Recommendable. I've gotten everything to work in the console but I can't get the right routes and I'm getting the "No route matches [GET] "/categories/1/posts/1/like"…

Daniel Garzon
- 185
- 1
- 3
- 12
0
votes
1 answer
Rails Nested Resource Routes
I'm fairly new to rails and I don't think I'm understanding the routing completely. When I try to access the edit action I get the following error:
ActiveRecord::RecordNotFound in StoreController#show
Couldn't find Gear with id=edit
Rails.root:…

DaveG
- 1,203
- 1
- 25
- 45
0
votes
4 answers
Simple Acts_as_tree with nested_resources
Using Rails 3.1.1 and the gem acts_as_tree. I have googled the issue and checked similar questions here at SO (the answers are too old, or irrelevant).
I have a model called articles with a route that today looks like:
resources :articles, :path…

Christoffer
- 2,271
- 3
- 26
- 57
-1
votes
1 answer
laravel nested controller with 3 model
is possible to use 3 model in laravel nested controller?
this my route now:
...
'supplier' => SupplierController::class,
'supplier.item' => SupplierItemController::class,
...
i want to use 3 like this one:
...
'supplier' =>…

Zulfikar
- 49
- 6
-1
votes
1 answer
react-router-v6 nested "Route" working on localhost but not on Cpanel
I am new to react and just learnt react-router-v6.
I wrote nested code for react-router-v6 which is actually working perfectly on Localhost but as soon as I am uploading the build on Cpanel (.htaccess file is already there), elements with nested…

Mustafa_Siddique
- 11
- 2