Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Since you have a nested route, you'll need in more than one argument to <code>calendar_blocked_time_path</code> in order to route to the correct <code>BlockTime</code>:</p> <pre><code>calendar_block_time_path(@calendar, @blocked_time) </code></pre> <p>If you want to get the <code>index</code> action for the <code>BlockTimesController</code>, use the following path, passing <em>only</em> the <code>Calendar</code> <code>id</code>:</p> <pre><code>calendar_block_times_path(@calendar) </code></pre> <p>Notice that, since you're trying to access a plural resource (block times, in this case), you'll want to invoke the pluralize form of the resource – that is, <code>calendar_block_times</code>.</p> <p>Remember that you can always run <code>rake routes</code> from the command line to get a full host of the routes and their corresponding paths. Here's the output in your case:</p> <pre><code> calendar_blocked_times GET /calendars/:calendar_id/blocked_times(.:format) blocked_times#index POST /calendars/:calendar_id/blocked_times(.:format) blocked_times#create new_calendar_blocked_time GET /calendars/:calendar_id/blocked_times/new(.:format) blocked_times#new edit_calendar_blocked_time GET /calendars/:calendar_id/blocked_times/:id/edit(.:format) blocked_times#edit calendar_blocked_time GET /calendars/:calendar_id/blocked_times/:id(.:format) blocked_times#show PUT /calendars/:calendar_id/blocked_times/:id(.:format) blocked_times#update DELETE /calendars/:calendar_id/blocked_times/:id(.:format) blocked_times#destroy calendars GET /calendars(.:format) calendars#index POST /calendars(.:format) calendars#create new_calendar GET /calendars/new(.:format) calendars#new edit_calendar GET /calendars/:id/edit(.:format) calendars#edit calendar GET /calendars/:id(.:format) calendars#show PUT /calendars/:id(.:format) calendars#update DELETE /calendars/:id(.:format) calendars#destroy </code></pre> <p>As you'll notice, the correct path to a calendar block time is <code>/calendars/:calendar_id/blocked_times/:id</code>. The first argument passed to <code>calendar_block_time_path</code> is the <code>:calendar_id</code>, and the second argument passed is <code>:id</code> – that is, the <code>id</code> of the <code>BlockTime</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload