# Login form

**URL:** <https://www.ruby-forum.com/t/login-form/156168>\
**Category:** Ruby\
**Created:** [December 22, 2008, 4:14am UTC](https://www.ruby-forum.com/t/login-form/156168 "2008-12-22T04:14:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@johny](https://www.ruby-forum.com/u/johny)\
**Post date:** [December 22, 2008, 4:14am UTC](https://www.ruby-forum.com/t/login-form/156168/1 "2008-12-22T04:14:42Z")

</div>

I just want to create a login form on my RoR project.anyone have a good  
suggestion,what do i need?

---

<div class="post-metadata">

**Author:** ![johny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@johny](https://www.ruby-forum.com/u/johny)\
**Post date:** [December 22, 2008, 5:41am UTC](https://www.ruby-forum.com/t/login-form/156168/2 "2008-12-22T05:41:21Z")

</div>

please look on the site [www.railscasts.com](http://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](http://railscasts.com/episodes/67-restful-authentication)  
goo luck

---

<div class="post-metadata">

**Author:** ![johny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@johny](https://www.ruby-forum.com/u/johny)\
**Post date:** [December 22, 2008, 5:54am UTC](https://www.ruby-forum.com/t/login-form/156168/3 "2008-12-22T05:54:47Z")

</div>

On Mon, Dec 22, 2008 at 12:06 PM, Johny ben [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I just want to create a login form on my RoR project.anyone have a good  
> suggestion,what do i need?

check out [http://goldberg.240gl.org/](http://goldberg.240gl.org/) for the goldberg plugin

saji

–  
Saji N. Hameed

APEC Climate Center +82 51 668 7470  
National Pension Corporation Busan Building 12F  
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed\_email\_address@domain.invalid  
KOREA

---

<div class="post-metadata">

**Author:** ![johny](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@johny](https://www.ruby-forum.com/u/johny)\
**Post date:** [December 26, 2008, 4:03am UTC](https://www.ruby-forum.com/t/login-form/156168/4 "2008-12-26T04:03:13Z")

</div>

Rustam M. wrote:

> please look on the site [www.railscasts.com](http://www.railscasts.com) i guess there is a tutorial  
> about  
> what you are looking for .tutorial about restful\_authentication  
> [#67 restful\_authentication - RailsCasts](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 :profile  
end

```
 class Profile < ActiveRecord::Base
   belongs_to :user
 end

```

My Migration  
class AddProfileTable \< ActiveRecord::Migration  
def self.up  
create\_table :profiles do |t|  
t.string :lastname  
t.string :firstname  
t.integer :user\_id

```
end

```

end

def self.down  
remove\_table :profiles  
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| %\>

**Name**  
 \<%= f.text\_field :login %\>

**Email**  
 \<%= f.text\_field :email %\>

  

\<%= f.submit "Update" %\>

 \<% end %\>

How can add the lastname field on edit form?how the update method look  
like?
