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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:19:35+00:00 2026-06-14T20:19:35+00:00

How should I setup url for that partial form to be able use it

  • 0

How should I setup url for that partial form to be able use it for create and update action.

Right now I have to set up two urls: admin_faculty_path for update and admin_faculties_path for create action.

# admin/faculties/_form.html.haml
= simple_form_for @faculty, html: { multipart: true, class: 'form-horizontal' } do |f|
  = f.input :department_id, as: :hidden, input_html: { value: params[:department_id] } if params[:department_id]
  = f.input :name
  = f.input :name_en
  = f.submit

Routes:

admin_faculties    POST   /admin/faculties(.:format)              admin/faculties#create
new_admin_faculty  GET    /admin/faculties/new(.:format)          admin/faculties#new
edit_admin_faculty GET    /admin/faculties/:id/edit(.:format)     admin/faculties#edit
admin_faculty      GET    /admin/faculties/:id(.:format)          admin/faculties#show
                   PUT    /admin/faculties/:id(.:format)          admin/faculties#update

Controller:

# faculties_controller.rb
  def new
    @faculty = Faculty.new
  end

  def create
    @faculty = Faculty.new(params[:faculty])

    if @faculty.save
      redirect_to admin_departments_path,
        notice: t('activerecord.successful_save_data')
    else
      flash[:error] = t('activerecord.save_data_error_html')
      render 'new'
    end
  end

  def edit
    @faculty = Faculty.find(params[:id])
  end

  def update
    @faculty = Faculty.find(params[:id])

    if @faculty.update_attributes(params[:faculty])
      redirect_to admin_departments_path,
        notice: t('activerecord.successful_save_data')
    else
      flash[:error] = t('activerecord.save_data_error_html')
      render 'edit'
    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-14T20:19:36+00:00Added an answer on June 14, 2026 at 8:19 pm

    You need to pass the namespace to the form:

    simple_form_for [:admin, @faculty]
    

    See for example

    • Rails Routes Namespaces and form_for
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE 1: I have now setup IIS6 so .NET can handle calls to .css
I know that I should setup the trap service on each devices seperately but
I have a three tier set-up. Someone suggested I should get the ConnectionString from
I have a login page. In my web.config I setup a loginUrl so that
I'm pulling in JSON from an external URL. I then want to use that
I have setup a wordpress multisite blog that is load balanced over 5 servers
I have a HTTP Live streaming server setup that serves segmented mp3 audio content
I have a model that requires a valid format of a URL. class Event
First of all, I know that I should not use an SQLite database to
I have an admin setup that includes a lookup that spans a relationship, school__year

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.