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

Routes not looking right. Missing id and index

In a Rails 4.1 app I created a set of routes, to avoid severe nesting in this type of relationship: User has_and_belongs_to_many :blogs, join_table: 'blogs_users' User has_many :posts, through: :blogs Blogs has_and_belongs_to_many :users,…
user3379926
  • 3,855
  • 6
  • 24
  • 42
0
votes
0 answers

Ruby-on-Rails accessing table id

I have an application that includes two tables - Companies and Company_Listings. A Company may have one or more Company_Listings. Currently the application sets the company.id in cache (e.g. Rails.cache.write("company", @company) ) and within the…
user1854802
  • 388
  • 3
  • 14
0
votes
0 answers

CanCan and InheritedResources: load and authorize resource through a singleton resource without ID param in the URL

My users can define their own vocabularies. class User < ActiveRecord::Base has_many :vocabularies end class Vocabulary < ActiveRecord::Base belongs_to :user end Routes: resource :user do resources :vocabularies end Now I want to use CanCan…
0
votes
1 answer

undefined method `twitter_source_twitter_aggregation_methods_path' for #<#:0xc104ef4>

I have 3 nested resources: sources, twitter_source and twitter_aggregation_methods. The relationship of their respective models is as follows: sources.rb has_many :twitter_sources has_many :rss_sources twitter_source.rb has_many…
Mutuma
  • 1,943
  • 3
  • 24
  • 33
0
votes
2 answers

Routes on comments and votes

I have two models that can be commented on, Books and Movies. The comments are votable In my routes file: resources :books, :path => '' do resources :comments do member do post :vote_up end end In my comments controller: class…
Katie H
  • 2,283
  • 5
  • 30
  • 51
0
votes
2 answers

NoMethodError with renamed nested resources (false route using link_to)

I've ran into a problem which causes link_to @resource to fail. My view: <% @test_thing = Bar.first #This one belongs to Foo.first %> <%= link_to "test link", @test_thing %> produces this error: NoMethodError undefined method `bar_path' for…
jomo
  • 14,121
  • 4
  • 29
  • 30
0
votes
1 answer

First argument in form cannot contain nil or be empty in rails 4.0

There are tons of these, especially for Rails 4.0 and Rails 3.x. I am new to nested routing and I find it very difficult, especially with forms. So I have the following: Routes resources :users do resources :api_keys, path:…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
0
votes
3 answers

ember.js - Mix resource routes with plain routes for non standard nested layout

I want the following layout: So when at /courses I display all courses in a screen-wide template, however when a user navigates to a course e.g. /courses/2, it then becomes a nested view with the list of courses on the left hand side and the course…
cjroebuck
  • 2,273
  • 4
  • 30
  • 46
0
votes
1 answer

Strong parameters and Nested Routes - Rails 4.0

I have no idea how this works in rails but I set up routes like this: resources :users do resources :api_keys end (User has_many: api_keys, api_key belongs_to: user) So I then (since I only care about API Keys), created the following…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
0
votes
0 answers

RSpec: Testing Nested Route

I've searched the site here and was unable to find the solution to my issue. I have the following nested route: resources :posts, except: [:destroy] do resources :comments, only: [:create] end I'd like to test the comments controller,…
DMiller
  • 253
  • 1
  • 3
  • 15
0
votes
1 answer

Rails nested singleton routing

I have a basic User class, and each user has a number of has_one associations with other objects (account, profile, etc). I have my routes nested as such: resources :users do resource :account resource :profile end And that gives me the…
kid_drew
  • 3,857
  • 6
  • 28
  • 38
0
votes
2 answers

rails link to nested route not working

I have the following in routes: resources :projects do resources :schedules end I am trying to go to the show schedule page. Rake routes lists this: project_schedule GET /projects/:project_id/schedules/:id(.:format) schedules#show I have the…
0
votes
2 answers

EmberJS Naming Convention For: { path: "/:object_id" }

I'm very new to Ember. Im having trouble with this dynamic url feature in nested routes. I understand nesting routes in general like: App.Router.map(function(), { this.resource('orders', function(){ this.route('order', { path:…
0
votes
1 answer

Emberjs : function prototype in hash

I have a four vertical panels UI : The first panel shows the menu and allows you to choose the data you want to display The second panel lets you select a filter from a list of pre-defined filters The third panel lets you see results list of the…
Mehdi
  • 3
  • 2
0
votes
1 answer

How to put the control name before action name in routes on Rails 3

handy_network_tools is my controller search_camera is my action in the controller I want to write the routes file in nested way. resources :handy_network_tools do collection do get :search_camera end end I prefer…
newBike
  • 14,385
  • 29
  • 109
  • 192