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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:46:13+00:00 2026-05-17T17:46:13+00:00

I have a model for a task which has a name, description, the process

  • 0

I have a model for a task which has a name, description, the process it belongs to, the position and a category.

As there are only two different categories I have created additional controllers specific to the categories as they need to be treated differently. when i submit the edit form in one of the category controllers it is redirecting back to the main tasks controllers show action. It seems to be skip the category controller all together (I tested this by just rendering text at each stage, it doesn’t even touch the update action). I looked at the html output that is rendered and the form is being submitted to the wrong controller, but I can’t see any way to change that.

So how do you set the form action in rails?

sub category controller edit:

def edit
  @task = Task.find(params[:id])
  @procedures = Procedure.find(:all, :conditions => "comdecom = true")
  @gettasks = Task.all
end

This renders the category view edit:

<div id="page">
  <h1>Editing Commissioning task</h1>
  <%= render :partial => 'form' %>
  <%= link_to 'Back', com_tasks_path %>
</div>

With the partial ‘form’:

<div id="form">
<% form_for(@task) do |f| %>
  <%= f.error_messages %>

  <p>
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.label :description %><br />
    <%= f.text_area :description %>
  </p>
  <p> To format your text you can use either html or the redcloth textile markup language. A full list of commands can be found at <a href="http://redcloth.org/"> http://redcloth.org/ </a></p>
  <p>
    <%= swapselect :task, @task, :procedure, @procedures.map {|procedure|[procedure.name, procedure.id]} %>
  </p>
  <p>
    <%= f.label :position, 'Position after:' %><br />
    <%= f.collection_select "position", @gettasks, :position, :name %>
  </p>
  <p>
    <%= f.hidden_field :comdecom, :value => '1' %>
    <%= f.hidden_field :active, :value => '1' %>
  </p>
  <p>
    <%= f.submit 'Submit' %>
  </p>
<% end %>
</div>

When you hit the submit button it takes you through to the tasks controller.

  • 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-17T17:46:13+00:00Added an answer on May 17, 2026 at 5:46 pm

    I found that you can put a URL to the form for it to go to after so I have changed the form opening tags to:

    <% form_for(@task, :url => {:controller => 'com_tasks', :action => 'update', :id => params[:id]}) do |f| %>
    

    I had to get rid of my partials because I couldn’t specify both actions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.