Forum: Ruby on Rails Form Data Not Saving - probably something simple

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8027b6e8cdfd9ed612d460fccd04b9d5?d=identicon&s=25 James Okelly (dreamer)
on 2007-02-20 11:01
Hello. I switched to rails and mac from c# and a pc. I'm lovin it, but
wierd things keep happening with my code and after 3 days I am totally

I have a form in login.rhtml

    <%= form_tag :action => 'process_registration' %>


        <p>Email Address:<br><%= text_field "user", "email_address", :id
=> 'stext' %><br>
        Password:<br><%= password_field "user", "password", :id =>
'stext' %><br>
        Confirm Password:<br><%= password_field "user",
"confirm_password", :id => 'stext' %><br>
        <span style="margin: 16px;"><%= submit_tag 'register' %></span>

    <%= end_form_tag %>

this goes to my controller code:

def process_registration
@user =[:user])

my migration for the table:

  def self.up
    create_table :users do |t|
      t.column :first_name, :string, :limit => 32
      t.column :last_name, :string, :limit => 32
      t.column :email_address, :string, :limit => 128, :null => false
      t.column :password, :string, :limit => 32, :null => false

I can manually insert into the table, I can also circumvent my form and
just do a

@u =
@u.email_address = ""
@u.password = "something"

that adds a row. if I use[:user]) or even
@u.email_address = params[:user][:email_address] then I get nulls in the

I am going insane! I have migrated down and back up, removed all
validation from my model:

class User < ActiveRecord::Base

  attr_accessor :password, :email_address
  attr_accessor :confirm_password

  def self.authenticate( user )
    find( :first, :conditions => [ "email_address = ? and password = ?",
        user[:email_address], user[:password] ] )



i have redone my form over and over, the code goes from the form to the
controller, calls the right method, etc. if I use the debugger I can see
my value in the params[:user][:password] but when save is called it only
inserts nulls.

Am I missing something really stupid?

Please help, my client is getting pissed :)
8027b6e8cdfd9ed612d460fccd04b9d5?d=identicon&s=25 James Okelly (dreamer)
on 2007-02-20 11:24
Nevermind :) I was doing a couple of things screwy that Ruby didn't
like. for instance I had confirm_password instead of
password_confirmation. Everything is working as expected now.
This topic is locked and can not be replied to.