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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:52:24+00:00 2026-05-17T23:52:24+00:00

I have my form <% form_tag users_path, :id => ‘registrationForm’ do %> <div class=formElement>

  • 0

I have my form

<% form_tag users_path, :id => 'registrationForm' do %>
  <div class="formElement">
    <label for="emailAddress">Email Address</label>
    <input name="user[email]" type="text">
  </div>
  <div class="formElement">
    <label for="password">Password</label>
    <input id="password" name="user[password]" type="password">
  </div>
  <div class="formElement">
    <label for="passwordConfirmation">Re-Enter Password</label>
    <input id="passwordConfirmation" name="user[password_confirmation]" type="password">
  </div>

  <div class="formElement right">
    <input name="commit" value="Create" type="submit">
  </div>
<% end %>

and then my controller method to process this which contains

@user = User.new(params[:user])
@user.save do |result|
  ...
end

This works fine. However, if I add ‘first_name’ and ‘last_name’ fields to my database table and add

<div class="formElement">
  <label for="firstName">First Name</label>
  <input id="firstName" name="user[first_name]" type="text" />
</div>
<div class="formElement">
  <label for="lastName">Last Name</label>
  <input id="lastName" name="user[last_name]" type="text" />
</div>

to my form, I get

Mysql::Error: Column ‘last_name’
cannot be null: INSERT INTO users
(salt, ship_address_id,
created_at, single_access_token,
last_request_at, bill_address_id,
crypted_password,
remember_token_expires_at,
updated_at, perishable_token,
api_key, failed_login_count,
current_login_ip,
openid_identifier,
current_login_at, last_name,
remember_token, persistence_token,
login_count, last_login_ip,
last_login_at, login, email,
first_name)
VALUES(‘gPa4FNsPHbfxLz1FTZJ8’, NULL,
‘2010-11-03 18:07:24’,
‘INl0QTDduoCKSdLLXEqb’, ‘2010-11-03
18:07:24’, NULL,
‘900d7300768651e4814ca16b1dd39b85e8111c92a63d366c82e3f1d501dc7b85efc060bc2032e55e4405fe33b0883b0ad586fe47e99261b046a34a8b9d785333’,
NULL, ‘2010-11-03 18:07:24’,
‘r8YSPUfKsmbIIJryvz5C’, NULL, 0,
‘127.0.0.1’, NULL, ‘2010-11-03
18:07:24’, NULL, NULL,
‘d4fe33e9c1bde5e2468d74d3dc1de28089f565d7e0d39584690452547be6d3bbf529e9ac118575529f34e377cce315697538c64b19f799e386d6977a8f37912e’,
1, NULL, NULL, ‘testuser3@test.com’,
‘testuser3@test.com’, NULL)

Here’s the parameters the error page says were passed:

{“commit”=>”Create”,
“authenticity_token”=>”tFpn+DGMU3VfeaSrc5ckVoVCxfy76Xm0Mqf8Jx8JEFs=”,
“user”=>{“password_confirmation”=>”test”,
“last_name”=>”User3”,
“password”=>”test”,
“first_name”=>”Test3”,
“email”=>”testuser3@test.com”}}

Any ideas why I get this MySQL error?

  • 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-17T23:52:24+00:00Added an answer on May 17, 2026 at 11:52 pm

    Are you using attr_accessible or attr_protected in your User model to guard against mass-assignment exploits?

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

Sidebar

Related Questions

I have a form like this: <form name=mine> <input type=text name=one> <input type=text name=two>
I have a form with many input fields. When I catch the submit form
I have a string which contain tags in the form < tag > .
I have form area in my view. If I click button A , I
I have form that displays several keywords (standard set of choice lists that changes
I have a form in C# that has a button that, when clicked, I
I have subclassed Form to include some extra functionality, which boils down to a
I have a form with some radio buttons that are disabled by default. When
I have a form in which people will be entering dollar values. Possible inputs:
I have a form element that contains multiple lines of inputs. Think of each

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.