Help please: database column not taking

I created a simple registration form. One column doesn’t seem to be
taking the input. I’ve yet to put in any validation or error
checking.

The column in the database is called ‘level’ and is type ‘int’

The controller method is fairly simple:
def register
c = User.new(params[:user])
c.save
redirect_to :controller => “main”
end

The form input is in the way of a select:
Account Type:
<%= select(:level, :id, [ [‘Choose’, 0],
[‘Job seeker’, 1],
[‘Recruiter’, 2],
[‘Direct Employer’, 3]])%>

In the user model, following along with Rails Recipes I recreated the
method of salt and hash (this is working fine) I’ll put it here anyway
in case it means something:
def password=(pass)
salt = [Array.new(6){rand(256).chr}.join].pack(“m”).chomp
self.password_salt, self.password_hash =
salt, Digest::SHA256.hexdigest(pass + salt)
end

I don’t see anything that sticks out yet it leaves the field blank
after creating a new row.

??
TIA
Stuart

Sorry, fixed! Realize I had the wrong params on the select lable.

Stuart

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs