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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:26:28+00:00 2026-06-02T04:26:28+00:00

def create user = User.find_by_email(params[:email]) if user && user.authenticate(params[:password]) session[:foo] = bar session[:user_id] =

  • 0
  def create
    user = User.find_by_email(params[:email])

    if user && user.authenticate(params[:password])
      session[:foo] = "bar"
      session[:user_id] = user.id
      redirect_to root_url, notice: "Signed in!"
    else
      flash.now[:error] = "Email or password is invalid."
      render "new"
    end
  end

When I decode the base64 cookie, I get:

{I"session_id:EFI"%14cd484a34917f7d923ef8222c16e0e1;TI"foo;FI"bar;FI"_csrf_token;FI"1ajWlOZok1Amp8Nh9uOdUWzeM20b873zocEbyiR+b1ao=;FI"user_id;Fi }

How come the my session[:foo] is set but not my session[:user_id] ?

  • 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-02T04:26:30+00:00Added an answer on June 2, 2026 at 4:26 am

    Looks to me that it is set, but the value of user_id is such that it’s Marshal.dump output (which is what a cookie stores) is a non printable or whitespace character. If you’re interested in why only user_id is affected in this way you’d have to look into the details of the marshal format (which doesn’t appear to be widely documented). I’d guess that with integers ruby basically spits out the byte value(s), which will often result in unprintables.

    I don’t know how you’re doing that base64 decode, but if you do it in a ruby console then the default output of inspect does show non printable characters

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

Sidebar

Related Questions

Controller Call user = User.authenticate(params[:session][:email], params[:session][:password]) Authenticate Method in user.rb class << self def
I want to make simple authentication like # SessionController require 'session.rb' def create Session.new(params[:email],
I have this test case def setUp(self): self.user = User.objects.create(username=tauri, password='gaul') def test_loginin_student_control_panel(self): c
What does the @posts line do exactly? def index if params[:user_id] && params[:artist_id] @id
def new @title = Create a user @user = User.new end <%= form_for(@user) do
So I create a class in ruby: class User def initialize end end Now
I want to create an XSD which can generate the following XML. <note> <email:to>abc@def.com</email:to>
So I've got a user model, with login, email address, password, password confirmation, name,
I have a find_or_create_by: def create @code = Code.find_by_code(params[:redemption][:code]) @redemption = @code.redemptions.find_or_create_by_user_id(current_user.id) if @redemption.save
Here is a comm_logs controller 'create' def create if has_create_right? @customer = Customer.find(params[:customer_id]) @comm_log

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.