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

  • Home
  • SEARCH
  • 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 783481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:33:17+00:00 2026-05-14T20:33:17+00:00

ok here’s some code: prompt>rails my_app prompt>cd my_app prompt>script/generate scaffold service_type title:string time_allotment:integer prompt>rake

  • 0

ok here’s some code:

prompt>rails my_app
prompt>cd my_app
prompt>script/generate scaffold service_type title:string time_allotment:integer
prompt>rake db:migrate

then edit these files to look like this:

#routes.rb:
ActionController::Routing::Routes.draw do |map|
  map.resources :services, :controller => :service_types
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

which produces these routes:

prompt>rake routes
    services GET    /services(.:format)                {:controller=>"service_types", :action=>"index"}
             POST   /services(.:format)                {:controller=>"service_types", :action=>"create"}
 new_service GET    /services/new(.:format)            {:controller=>"service_types", :action=>"new"}
edit_service GET    /services/:id/edit(.:format)       {:controller=>"service_types", :action=>"edit"}
     service GET    /services/:id(.:format)            {:controller=>"service_types", :action=>"show"}
             PUT    /services/:id(.:format)            {:controller=>"service_types", :action=>"update"}
             DELETE /services/:id(.:format)            {:controller=>"service_types", :action=>"destroy"}
                    /:controller/:action/:id           
                    /:controller/:action/:id(.:format)

_

 #my_app/app/views/service_types/index.html.erb
 <h1>Listing service_types</h1>

<table>
  <tr>
    <th>Title</th>
    <th>Time allotment</th>
  </tr>

<% @service_types.each do |service_type| %>
  <tr>
    <td><%=h service_type.title %></td>
    <td><%=h service_type.time_allotment %></td>
    <td><%= link_to 'Show', service_type %></td>
    <td><%= link_to 'Edit', edit_service_path(service_type) %></td>
    <td><%= link_to 'Destroy', service_type, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New service_type', new_service_path %>

–

#my_app/app/views/service_types/new.html.erb
<h1>New service_type</h1>

<% form_for(@service_type) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :title %><br />
    <%= f.text_field :title %>
  </p>
  <p>
    <%= f.label :time_allotment %><br />
    <%= f.text_field :time_allotment %>
  </p>
  <p>
    <%= f.submit 'Create' %>
  </p>
<% end %>

<%= link_to 'Back', services_path %>

when you try to access http://localhost:3000/services/new you get the following error:

undefined method `service_types_path' for #<ActionView::Base:0xb7199a80>

Extracted source (around line #3):

1: <h1>New service_type</h1>
2: 
3: <% form_for(@service_type) do |f| %>
4:   <%= f.error_messages %>
5: 
6:   <p>

Application Trace:

/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/polymorphic_routes.rb:107:in `__send__'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/polymorphic_routes.rb:107:in `polymorphic_url'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/polymorphic_routes.rb:114:in `polymorphic_path'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/form_helper.rb:298:in `apply_form_for_options!'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_view/helpers/form_helper.rb:277:in `form_for'
/home/aaron/NetBeansProjects/my_app/app/views/service_types/new.html.erb:3:in `_run_erb_app47views47service_types47new46html46erb'
/home/aaron/NetBeansProjects/my_app/app/controllers/service_types_controller.rb:29:in `new'

Anyone have any idea why it believes that service_types_path is in my code when it’s not?

  • 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-05-14T20:33:17+00:00Added an answer on May 14, 2026 at 8:33 pm
    <% form_for(@service_type) do |f| %>
    

    remove with

    <% form_for(@service_type, :url => services_path, :html => { :method => :post }) do |f| %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.