Rustam said:
please look on the site
www.railscasts.com i guess there is a tutorial
about
what you are looking for .tutorial about restful_authentication
http://railscasts.com/episodes/67-restful-authentication
goo luck
sir thank you for your reply I use the restful_authentication on my
login form.
I have a problem on how to edit the two model in one form.My application
run like this the user need to sign up,after sign up he can edit his
profile.
THe model :
class User < ActiveRecord::Base
has_one

rofile
end
class Profile < ActiveRecord::Base
belongs_to :user
end
My Migration
class AddProfileTable < ActiveRecord::Migration
def self.up
create_table

rofiles do |t|
t.string :lastname
t.string :firstname
t.integer :user_id
end
end
def self.down
remove_table

rofiles
end
end
My Controller
def edit
@user = User.find(params[:id])
end
def create
@user = User.new(params[:user])
@user.save
@profile = Profile.new
@profile.user_id = @user.id
@profile.save
if @user.errors.empty?
self.current_user =
@user
redirect_to :controller => "viewer", :action => "show",:name
=>'Home'
flash[:notice] = "Thanks for signing up!"
else
render :action => 'new'
end
end
The edit form
<% form_for(
@user) do |f| %>
<p>
<b>Name</b><br />
<%= f.text_field :login %>
</p>
<p>
<b>Email</b><br />
<%= f.text_field :email %>
</p>
<br />
<p> <%= f.submit "Update" %> </p>
<% end %>
How can add the lastname field on edit form?how the update method look
like?