开发者

How can I add a custom column in authlogic?

开发者 https://www.devze.com 2023-03-31 01:24 出处:网络
I\'ve created a simple user system with authlogic using Rails 3. I want to add an \"account_type\" column to the database. How can I populate this column in the database when the user signs up? I have

I've created a simple user system with authlogic using Rails 3. I want to add an "account_type" column to the database. How can I populate this column in the database when the user signs up? I have very very little experience with Rails.

Update: So I know somewhere in "@user = User.new(params[:user])" I need to add :account_type = "user". What's the right syntax for this though?

Here's what I have in my user controller:

class UserController < ApplicationController

   before_filter :require_no_user, :only => [:new, :create]

   def new
     @user = User.new
   end

   def create
     @user = User.new(params[:user])
     if @user.save
       flash[:notice] = "Registration successful!"
       redirect_to root_url
   开发者_如何转开发  else
       render :action => :new
     end
   end

 end

Thanks in advance!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号