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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:30:32+00:00 2026-05-31T04:30:32+00:00

I have controller with name AdminController where i have method create_school_head : class AdminsController

  • 0

I have controller with name AdminController where i have method create_school_head:

class AdminsController < ApplicationController
  ...
  def create_school_head
    @user = User.new
  end
  ...
end

Also i have view create_school_head:

<%= form_for @user, :html => {:class => "form-horizontal"} do |f| %>
    <fieldset>
      <div class="control-group">
        <%= f.label :user_login, "Login", :class => "control-label" %>

        <div class="controls">
          <%= f.text_field :user_login %>
        </div>
      </div>

      <div class="control-group">
        <%= f.label :password, "Password", :class => "control-label" %>

        <div class="controls">
          <%= f.text_field :password %>
        </div>
      </div>

    </fieldset>

    <%= f.submit "Create", :class => "btn btn-success" %>
<%  end %>

Routes.rb

ElSchool::Application.routes.draw do
  resources :users,    :only => [ :new, :create, :show ]
  resources :sessions, :only => [ :new, :create, :destroy ]

  get "sessions/new"

  match 'pages/wrong_page', :to => 'pages#wrong_page'
  match '/signin',          :to => 'sessions#new'
  match '/signout',         :to => 'sessions#destroy'

  match '/admins/backups', :controller => 'admins',
                           :action     => 'backups'

  match '/admins/users_of_system', :controller => 'admins',
                                   :action     => 'users_of_system'

  match '/admins/create_school_head', :controller => 'admins',
                                      :action => 'create_school_head'

  match '/admins/create_teacher', :controller => 'admins',
                                  :action => 'create_teacher'

  root :to => 'sessions#new'                                                  #Home
end

Right now it pass data to create method of User controller. I would like to send data from this form after buttons submit in other method of AdminController, for example in method process_school_head. How can i do that?

  • 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-31T04:30:33+00:00Added an answer on May 31, 2026 at 4:30 am

    You can use :url option in your form_for method. Eg.,

    <%= form_for @user, :url => process_school_head_url, :html => {:class => "form-horizontal"} do |f| %>
    

    You need to have this in your route too.

    match '/admins/process_school_head' => 'admins#process_school_head', :as => :process_school_head
    

    Hope it helps.

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

Sidebar

Related Questions

I have the following route defined routes.MapRoute( ItemName, {controller}/{action}/{projectName}/{name}, new { controller = Home,
I have a route: routes.MapRoute( Company, {id}/{name}.aspx, new { controller = Company, action =
I have the following code in a view: def controller_details(request, object_id): controller = Controller.objects.get(pk=object_id)
I have a controller called MetricsController with a single action method: public class MetricsController
Specifically, does a controller class name have to have the Controller suffix, and can
I have controller example name by test. In index method I will make session,
I'm working with a controller name page.php . This is what I have: class
I have the controller code as follows: $form_company=new Project_Form_AddCompany(); $this->view->form=$form_company; $form_company->setAction('add-Company'); if ($this->_request->isPost()) {
I have a action on my controller (controller name is 'makemagic') called 'dosomething' that
I have a get-parameter with name controller . When I try to pass it

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.