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 6644235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:08:37+00:00 2026-05-26T00:08:37+00:00

I have to make edit/create forms for several tables on one page (settings). Therefore

  • 0

I have to make edit/create forms for several tables on one page (settings). Therefore I have created SettingsController.

Routes:

resources :settings, :only => :index do
  member do
    get 'cs_edit'
    put 'cs_update'
    post 'cs_create'
    delete 'cs_destroy'
  end
end

The controller:

class SettingsController < ApplicationController
  before_filter :authenticate
...
def cs_create
  @cs = CaseStatus.find(params[:id])
  @cs.save

  redirect_to settings_path, :notice => 'Case Status was created successfully'
end

The view part:

<%= form_for(@cs, :url => url_for(:action => 'cs_create', :controller => 'settings'), :class => 'status_form') do |cs_f| %>

The question is that I am getting the following error:

Showing /home/michael/public_html/development/fbtracker/app/views/settings/index.html.erb where line #98 raised:

No route matches {:action=>"cs_create", :controller=>"settings"}
Extracted source (around line #98):

95:                   <% end %>
96:                 </table>
97: 
98:                 <%= form_for(@cs, :url => url_for(:action => 'cs_create', :controller => 'settings'), :class => 'status_form') do |cs_f| %>
99:                   <%= cs_f.text_field :name, :class => 'sname' %>
100:                  <%= cs_f.text_field :owt, :class => 'owt' %>
101:                  <%= cs_f.submit 'Add' %>

Also I just have checked routes:

$ rake routes
...
cs_edit_setting GET    /settings/:id/cs_edit(.:format)             {:action=>"cs_edit", :controller=>"settings"}
cs_update_setting PUT    /settings/:id/cs_update(.:format)           {:action=>"cs_update", :controller=>"settings"}
cs_create_setting POST   /settings/:id/cs_create(.:format)           {:action=>"cs_create", :controller=>"settings"}
cs_destroy_setting DELETE /settings/:id/cs_destroy(.:format)          {:action=>"cs_destroy", :controller=>"settings"}
settings GET    /settings(.:format)                         {:action=>"index", :controller=>"settings"}

As you can see, the route matches {:action=>”cs_create”, :controller=>”settings”} is exist. But url_for cannot find this route. Why?

  • 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-26T00:08:38+00:00Added an answer on May 26, 2026 at 12:08 am

    You have defined cs_create as a member method, but your url_for call doesn’t give it an object. If you really want to use url_for this way, you can do this:

    url_for(:id => @cs.id, :action => 'cs_create', :controller => 'settings')
    

    Or alternatively make it a collection method:

    resources :settings, :only => :index do
      post 'cs_create', :on => :collection
      member do
        get 'cs_edit'
        put 'cs_update'
        delete 'cs_destroy'
      end
    end
    

    However, as mentioned in the comments, this is basically ignoring all of the support that rails provides to make this easy. I’d recommend:

    • define a resources routing for CaseStatus that can use all the standard RESTful routes (that doesn’t mean you can’t make all these settings visible on a single page under /settings
    • use standard url helpers instead of url_for
    • understand that you don’t need a separate path for all the HTTP actions (e.g. show, update and delete are usually share all the same path, but with different HTTP actions)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a language selection dropdown in a site user edit/create page.
I have a crystal report file I need make a tiny edit in. It
I have to make a large amount of forms for a project I'm working
I have created a custom control that inherits System.Windows.Forms.Panel, and adds a few extra
I have a View that has the ability to both create and edit an
I have to make column charts in Excel using VBA only (no user input).
I have to make a schema for an XML format that's already being used.
I have to make a graphical user interface application using the language of my
I have to make a connection to an XMLRPC site from a web application,
I have to make a JSP/HTML pages. How to fix height and width on

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.