Forum: Ruby on Rails =?iso-8859-1?q?User=2Enew_doesn=B4t_capture_all_of_the_p?= =

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.
Martin S. (Guest)
on 2006-05-09 15:42
(Received via mailing list)

I have a page where I can add new users to the database, but it only
sees whats in the name and passord field.

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

	<td>User name:</td>
	<td><%= text_field("user", "name") %></td>
		<td><%= password_field("user", "password") %></td>
     	<td><%= text_field("user", "company") %></td

The database looks like this:
create table users (
	id      int           not null auto_increment,
	name    varchar(100)	not null,
	company varchar(100)  not null,
	ownnumber int					not null,
	sendt   int           not null,
	count   int           not null,
	msg_limit		int           not null,
	access_level		varchar(50)   not null,
	hashed_password	char(40)	not null,
	primary key	(id)


   def add_user
     if request.get?
       @user =
     else = (params[:user][:company])		# Tried first
without this line, since I didn´t see any for name and password.
												# I hoped the one below would capture all the fields.

       @user =[:user])				# How come this doesn't
manage to save whats in "company", "ownnumber" etc. ?

       puts "DEBUG: add_user() user is  #{} from the
company #{}, count is #{@user.count}" # this is empty

         redirect_to(:controller => "numbers", :action => "index")


Debug info:
Parameters: {"user"=>{"name"=>"test3", "company"=>"family",
"ownnumber"=>"555983781", "count"=>"10", "access_level"=>"",

How come  @user =[:user] doesn´t saves whats in
"company", "count" etc. ?

I´ll be very grateful to everyone that comes with suggestions or hint
on what I´m doing wrong!

Kind regards,
Martin S.
Philip R. (Guest)
on 2006-05-10 01:34
(Received via mailing list)
Martin S. wrote:
> Debug info:
> Parameters: {"user"=>{"name"=>"test3", "company"=>"family",
> "ownnumber"=>"555983781", "count"=>"10", "access_level"=>"",
> "password"=>"SECRET"}}
> How come  @user =[:user] doesn´t saves whats in
> "company", "count" etc. ?

Are you using attr_accessible or attr_protected in your User model? If
you are, you'll need to adjust them to allow company, count, etc to be

See the API docs for more information:

Philip R. -- DST-aware timezone library for Ruby
Martin S. (Guest)
on 2006-05-10 12:58
(Received via mailing list)
This topic is locked and can not be replied to.