login form

Discussion in 'Ruby' started by Johny ben, Dec 22, 2008.

  1. Johny ben

    Johny ben Guest

    I just want to create a login form on my RoR project.anyone have a good
    suggestion,what do i need?
    --
    Posted via http://www.ruby-forum.com/.
    Johny ben, Dec 22, 2008
    #1
    1. Advertising

  2. Johny ben

    rustam mamat Guest

    rustam mamat, Dec 22, 2008
    #2
    1. Advertising

  3. On Mon, Dec 22, 2008 at 12:06 PM, Johny ben <> 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
    KOREA
    Saji N. Hameed, Dec 22, 2008
    #3
  4. Johny ben

    Johny ben Guest

    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?
    --
    Posted via http://www.ruby-forum.com/.
    Johny ben, Dec 26, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. William F. Robertson, Jr.
    Replies:
    0
    Views:
    430
    William F. Robertson, Jr.
    Jul 2, 2003
  2. Hermit Dave

    Forms Login Page Not Login Out

    Hermit Dave, Jan 12, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    461
    Hermit Dave
    Jan 13, 2004
  3. DavidADEW
    Replies:
    2
    Views:
    2,699
    DavidADEW
    Sep 1, 2006
  4. manu
    Replies:
    1
    Views:
    779
    Evans
    Jul 20, 2008
  5. Bruce
    Replies:
    5
    Views:
    181
    Joseph MCAD
    Apr 11, 2005
Loading...

Share This Page