Ryan B. wrote:
Actually the best place to ask is right here.
Could you show us the code you’re using in your create action Ruchita?
On Dec 27, 2007 4:14 PM, Ruchita S.
[email protected]
wrote:
Actually I am implementing a registration form. In that I have applied a
Thanks,
Ruchita.
Posted via http://www.ruby-forum.com/.
–
Ryan B.
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.
The code for signup is:
def signup
@rightpanels = Rightpanel.find(:all, :limit => 2, :order => ‘rand()’)
@countries = Country.find :all
@user = User.new
@user = User.new(params[:user])
salt=‘hex123folkstory’
@user.password=Digest::SHA1.hexdigest(params[:user][:password] +
salt)
if @user.save
flash[:notice] = ‘You will recieve a mail on your account with login
info and link, once the admin activates your account’
redirect_to :controller => ‘store’, :action => ‘login’
else
flash[:notice] = ‘This Login already Exist.Try Again!’
render :action => ‘sign_up’ , :layout => true, :id => @user.id
redirect_to :action => ‘sign_up’, :controller => ‘store’
end
end
User model is:
validates_uniqueness_of :login, :message => “username already exists”
This is the code of controller and model.
Thanks,
Ruchita.