Questions tagged [nested-routes]

Nested routes allow to capture relationship in your routing.

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

462 questions
0
votes
1 answer

Rails 4 routing error with nested comments form using nested resources

I was following this tutorial http://www.sitepoint.com/nested-comments-rails/ to implement nested comments for an image board. It worked fine until I made "comments" belong to "boards" and then had to nest my routes. Here are my…
Ian Delairre
  • 131
  • 1
  • 7
0
votes
1 answer

Routing Error No Route Matches (correct route)

I'm in the process of building an edit form. I have completed the form and it renders as it should. When I go to submit the update to the form I get a no route error. The path to my edit page is for example '/topics/1/bookmarks/1/edit'. This…
Brandon
  • 45
  • 8
0
votes
0 answers

Ember transitionTo removed but still firing

This one has me baffled. I am still new to ember but I had some nested routes where I was calling transitionTo with the redirect hook on the parent route to pull in a nested child route. App.CategoryRoute = Ember.Route.extend({ redirect: {…
EHeine
  • 385
  • 1
  • 3
  • 13
0
votes
1 answer

Active admin nested_route for API endpoint

I am trying to build an API endpoint using active_admin and I am having trouble getting the route set up how I want them. I am also not sure if my solution for the routes is in accordance with REST best practices. I have the following models: class…
ruby_newbie
  • 3,190
  • 3
  • 18
  • 29
0
votes
1 answer

Nested routes, passing :user_id

I would like to create New Task button which will redirect to /users/:user_id/tasks/new Routes: devise_for :users resources :users do resources :tasks, shallow: true end Task Controller: def new @task = Task.new end View: <%=…
Gregy
  • 340
  • 1
  • 6
  • 16
0
votes
2 answers

Ember js search nested routes

I'm trying to make a search inside a nested route particularly that shares model. Here's my code example Products and Search returns a json Router Market.Router.map -> @resource 'products' @resource 'search', { path: "products/search" } …
abFx
  • 313
  • 3
  • 14
0
votes
1 answer

Getting the ID of a Model that Uses Nested Routes and Permalinks in Rails

So I had my app set up with ids like so: resources :studios do resources :bookings end This gave me the route to the index (which later I'm going to use json for to get calendars for each studio. studio_bookings GET …
Peege151
  • 1,562
  • 2
  • 21
  • 45
0
votes
1 answer

Rails - nested routes and form_for

I have in routes.rb resources :reckoners do resources: shift_requirements end In my partial for a new shift_requirement I have - <%= form_for ([@reckoner, ShiftRequirment.new]) do |f| %> but that's calling the path 'shift_requirement_path'…
dan
  • 1,030
  • 1
  • 9
  • 24
0
votes
1 answer

How to post to a nested resource in Rails?

I have a nested resource in my routes.rb file: resources :users do resources :children end I have a form at /users/:id/children/new. Form comes up fine and the embedded ruby for the form looks like this: <%= form_for(@user) do |f| %> Problem is…
0
votes
1 answer

creating nested rails route without parent id

I have 2 tables: campus (has_one) and notification (belongs_to) I want to setup my routes so the index url uses the following format: /campusname/notifications => campusname is an unique value With the nested routes my url always has an…
0
votes
1 answer

How to create nested routes with default parent in rails?

I have the following models: class Article < ActiveRecord::Base belongs_to :category end class Category < ActiveRecord::Base end Articles are nested under categories like this: resources :categories, only: [] do resources :articles, only:…
jokklan
  • 3,520
  • 17
  • 37
0
votes
1 answer

Nested route issue: "No route matches [GET] "/questions/6/responses"

I'm a rails beginner struggling with routes a bit. I'm working on a Q&A site (or question and response) and any time I try to post a response, it gives the following error: No route matches [GET] "/questions/6/responses" Any help would be greatly…
0
votes
0 answers

Ember actions in a nested resource

I'm attempting to add some actions to the nested route of Publishables in Ember: Router.map(function() { this.resource('publishables', {path: '/publishables'}, function() { this.resource('publishable', { path: ':publishable_id' }); …
tr3online
  • 1,429
  • 2
  • 24
  • 45
0
votes
1 answer

use a different index column for loading models in rails 3

In my app users can store private trades in their accounts, such trades are visible only to them. The Trade model looks like this: class Trade < ActiveRecord::Base scope :by_user, lambda { |user| where(user_id: user.id) unless user.nil? …
Don Giulio
  • 2,946
  • 3
  • 43
  • 82
0
votes
1 answer

Is it possible to use nested resource in case of POST?

I use Play Framework 2.2.X. Is it possible to map this route?: POST /api/constructors/:constructorId/cars CarCrudController.create(constructorId) I get a BadRequest (code 400) when hitting this route. IMO, it seems that Play allows nested…
Mik378
  • 21,881
  • 15
  • 82
  • 180