I have a form to register a user. The issue I am having is the fact that
it only populates login, hashed_password and created_at fields.
DB table:
create table users (
id int not null auto_increment,
login varchar(100) default null,
hashed_password char(40) default null,
email varchar(255) default null,
salt varchar(255) default null,
address varchar(255) null,
city varchar(255) not null,
state varchar(255) not null,
country varchar(255) not null,
phone varchar(255) not null,
website varchar(255) not null,
created_at datetime null,
primary key (id)
);
users_controller:
# Add a new user to the database.
def register_user
if request.get?
@user = User.new
else
@user = User.new(params[:user])
if @user.save
flash[:notice] = "User #{@user.login} created"
#redirect_to :action => ''//login/login''
redirect_to :controller=>''adverts'',
:action=>''list''#, :id =>
@user.id
end
end
end
register_user.rhtml:
<h1>Please Sign Up</h1>
The More information you provide the easier it will be for people to
find you or your company.
<%= start_form_tag :action => ''register_user'' %>
<%= render :partial => ''form'' %>
<%= submit_tag "Register" %>
<%= end_form_tag %>
_form.rhtml:
<%= error_messages_for ''user'' %>
<!--[form:entry]-->
<table>
<tr>
<td>User name or company name:</td>
<td><%= text_field("user", "login")
%></td>
<td></td>
</tr>
<tr>
<td>Password:</td>
<td><%= text_field("user", "password")
%></td>
<td></td>
</tr>
<tr>
<td>Email:</td>
<td><%= text_field("user", "email")
%></td>
<td></td>
</tr>
<tr>
<td>Address:</td>
<td><%= text_field("user", "address")
%></td>
<td></td>
</tr>
<tr>
<td>City:</td>
<td><%= text_field("user", "city")
%></td>
<td></td>
</tr>
<tr>
<td>State:</td>
<td><%= text_field("user", "state")
%></td>
<td></td>
</tr>
Please help
--
Posted via http://www.ruby-forum.com/.