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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:02:25+00:00 2026-06-10T03:02:25+00:00

My question pertains to a Rails naming convention conundrum. My application has sign up,

  • 0

My question pertains to a Rails naming convention conundrum. My application has sign up, sign in, sign out features.

For the sign up page, I used form_for(@user) helper.

For the sign in page I used a form_for(:session, url: sessions_path). But in my routes.rb file I have included the resources :sessions instead of the singular as mentioned in the argument of form_for helper in the sign in page.

If someone could:

1.) Solve this particular form_for issue

2.) More importantly point me in the direction where I can learn/read about Rails naming conventions, I would be highly indebted.
  • 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-10T03:02:27+00:00Added an answer on June 10, 2026 at 3:02 am
    1. I bet that @user has been initialized with User.new – this is a new user. When you sign up you want to create a new user so you can translate form_for(@user) as “form for a new user”. Note that in this case you provide form_for an ActiveRecord User instance, which is the way it was meant to be used.
    2. When you give form_for a symbol and not an instance of an ActiveRecord model, it uses the symbol to nest the inputs inside the form. For example, if you put <%= f.text :name %> in your form it will generate <input name="session[name]" type="text">. Also, when an existing user signs in you do not want to create a new user(like in step 1), you just want to create a new session for an existing user, thus posting to sessions_path looks very intuitive.
    3. You can type the command rake routes in your terminal and get all the named routes set for your application, this will give you a very good insight of how rails converts the resources command into named routes.

    For further info read the following:

    Rails Routing Guide

    form_for ApiDock documentation

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

Sidebar

Related Questions

I'm on Windows 7. My question pertains to the 'percent codes' used to specify
This question pertains to Ruby on Rails and PHP. When looking for a VPS
I'm currently integrating external applications in my app ex SalesForce.com. My question pertains to
thank you for your time, (As a side note, this question pertains mostly to
I hope I'm not breaking any rules by asking a question that pertains to
This question pertains to MVC (Model-View-Controller). My Model currently updates my View when it
My question pertains to the order of initialization of global objects. It is discussed
To all: This question pertains to some MS research I am doing. What I
Afternoon all, My question pertains to 2 chained forms, where values from the first
I have a question web application which allows users to ask questions on specific

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.