Forum: Ruby login form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D7b2632679975d1175b449ca015b918f?d=identicon&s=25 Johny ben (johny)
on 2008-12-22 04:14
I just want to create a login form on my RoR project.anyone have a good
suggestion,what do i need?
43ab97fb1e3407725cca098ce76c4715?d=identicon&s=25 Rustam Mamat (rustam)
on 2008-12-22 05:41
(Received via mailing list)
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
621080472679266b8e9b81aff4800398?d=identicon&s=25 Saji N. Hameed (Guest)
on 2008-12-22 05:54
(Received via mailing list)
On Mon, Dec 22, 2008 at 12:06 PM, Johny ben <joh13ny@yahoo.com> 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/ 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      saji@apcc21.net
KOREA
D7b2632679975d1175b449ca015b918f?d=identicon&s=25 Johny ben (johny)
on 2008-12-26 04:03
Rustam Mamat wrote:
> 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 :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| %>
   <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?
This topic is locked and can not be replied to.