Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:28:23+00:00 2026-06-05T14:28:23+00:00

I’m working on a map for the network in my building. I have the

  • 0

I’m working on a map for the network in my building. I have the separate floor models working, which list each switch when you click on the show method. Then I would like to have it so you can click on each switch to see the jack numbers on each switch port. I have the view for the switch working thanks to another question I’ve asked, but now I’m stuck trying to show the jacks in that same show. Here is my partial for the jacks (app/views/jacks/_jacks.html.erb):

<%= form_for <WhatDoIPutHere?> do |f| %>
  <div class="field">
    <%= f.label :number %><br />
    <%= f.text_field :number %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

Now I know I need to run a rake routes to figure out the path.
Here is my rake routes result:

floor_switch_jacks GET    /floors/:floor_id/switches/:switch_id/jacks(.:format)         jacks#index
                   POST   /floors/:floor_id/switches/:switch_id/jacks(.:format)          jacks#create
new_floor_switch_jack GET    /floors/:floor_id/switches/:switch_id/jacks/new(.:format)      jacks#new
edit_floor_switch_jack GET    /floors/:floor_id/switches/:switch_id/jacks/:id/edit(.:format) jacks#edit
 floor_switch_jack GET    /floors/:floor_id/switches/:switch_id/jacks/:id(.:format)      jacks#show
                   PUT    /floors/:floor_id/switches/:switch_id/jacks/:id(.:format)      jacks#update
                   DELETE /floors/:floor_id/switches/:switch_id/jacks/:id(.:format)      jacks#destroy
    floor_switches GET    /floors/:floor_id/switches(.:format)                           switches#index
                   POST   /floors/:floor_id/switches(.:format)                           switches#create
  new_floor_switch GET    /floors/:floor_id/switches/new(.:format)                       switches#new
 edit_floor_switch GET    /floors/:floor_id/switches/:id/edit(.:format)                  switches#edit
      floor_switch GET    /floors/:floor_id/switches/:id(.:format)                       switches#show
                   PUT    /floors/:floor_id/switches/:id(.:format)                       switches#update
                   DELETE /floors/:floor_id/switches/:id(.:format)                       switches#destroy
            floors GET    /floors(.:format)                                              floors#index
                   POST   /floors(.:format)                                              floors#create
         new_floor GET    /floors/new(.:format)                                          floors#new
        edit_floor GET    /floors/:id/edit(.:format)                                     floors#edit
             floor GET    /floors/:id(.:format)                                          floors#show
                   PUT    /floors/:id(.:format)                                          floors#update
                   DELETE /floors/:id(.:format)                                          floors#destroy
        home_index GET    /home/index(.:format)                                          home#index
              root        /                                                              home#index

My question is how do I read the rake routes to find the proper syntax for the form_for line? I had this same problem getting my switch view to work in the first place. If this is an easy question and there is a guide out there feel free to just send me to that instead. I can’t seem to find one specific to to this.

Thanks in advance for any help!

EDIT:

class JacksController < ApplicationController

  def create
    @switch = Switch.find(params[:switch_id])
    @jack = @switch.jacks.create(params[:jack])
    redirect_to switch_path(@switch)
  end

  def destroy
    @switch = Switch.find(params[:switch_id])
    @jack = @switch.jacks.find(params[:id])
    @jack.destroy
    redirect_to switch_path(@switch)
  end

end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:28:25+00:00Added an answer on June 5, 2026 at 2:28 pm

    You can have nested forms for your nested models.

    form_for @floor do |f|
      f.fields_for :switches do |g|
        g.fields_for :jacks do |h|
          h.label :number
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.