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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:42:40+00:00 2026-06-13T18:42:40+00:00

I have a form that I want a user to put in their name

  • 0

I have a form that I want a user to put in their name and email, which get stored in a session. They can then post text in a chat box.

In my view, to create the initial session:

<%= simple_form_for(@comments, :url => guest_login_order_path(@order)) do |f| %>
        <input name="comment[new_user_comment_name]" />
        <input name="comment[new_user_comment_email]" />
        <%= f.button :submit, :value => 'Guest Signin', :class => '' %>
    <% end %>

This goes to my controller:

def guest_login
    @order = Order.where(:public_hash => params[:public_hash]).first
    session[:new_user_account] = params[:new_user]

    respond_to do |format|
      if session[:new_user_account]
        format.html { redirect_to @order, notice: 'Your account has been created.' }
        format.json { render json: @order, status: :created, location: @order }
      else
        format.html { render action: "invoice" }
        format.json { render json: @order.errors, status: :unprocessable_entity }
      end
    end
  end

The params get passed correctly but I’m not quite sure if the cookie is being created. Is there way to specify a name so I can see if it was created? Also in the view, would I have a conditional then to see if there is a session present?

  • 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-13T18:42:41+00:00Added an answer on June 13, 2026 at 6:42 pm

    Rails creates a session for you so you don’t need to check if it’s present. If you’d like to easily retrieve the user from the session you can create a helper method in your application controller:

    class ApplicationController < ActionController::Base
        def current_user
            @current_user ||= session[:new_user_account]
        end
    
        helper_method :current_user
    end
    

    This method will be available to other controllers and views in your app.

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

Sidebar

Related Questions

Hi i have a form in my application where user can put their details.
I have made a form that asks the user to put in first name
Here's what I want to do. I have a form that the user fills
I want to have a Form that can Add or Delete TextFields. I was
I have a form that validates the email address and I want to be
Let's say I want to have a Form with a field, email, that is
I have a form that I want to ensure the paypal email address is
I'm trying to create a form where a user can type in their email
I have a form that I want to be validated before showing it initially.
I have a form that i want to appear at the top of every

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.