Error_messages_for not working

I have the following code and I am not able to get it working. The
error message is not coming on the top, it is just getting displayed
on a different page if I dont have the rescue block commented at the
bottom.

Model: user.rb
require “digest/sha1”

class User < ActiveRecord::Base

validates_presence_of :eaddress, :fname, :passwd, :pcode, :country,
:day, :year, :month, :gender,
:agreement

validates_confirmation_of :passwd
validates_uniqueness_of :eaddress
validates_length_of :eaddress, :within => 6…255
validates_numericality_of :pcode

end

View: index.rhtml

Quick Register!

<%= form_tag(:controller => “login”, :action => “register_user”) %>
<%= error_messages_for(:user) %>

Controller: community_controller.rb
def register_user

begin

@user = User.new(params[“user”])
@user.passwd = User.hash_password(params[“user”][“passwd”])
if @user.save!
redirect_to(:controller => “profile”, :action => “createprofile”)
else
render(:template => “login/index”)
end

rescue Exception => exc

flash[:notice] = “General error in registration = #{exc.message}”

render(:template => “login/index”)

return

end

end

Reposting as I am not sure if this message got any replies.

I have the following code and I am not able to get it working. The
error message is not coming on the top, it is just getting displayed
on a different page if I dont have the rescue block commented at the
bottom.

Model: user.rb
require “digest/sha1”

class User < ActiveRecord::Base

validates_presence_of :eaddress, :fname, :passwd, :pcode, :country,
:day, :year, :month, :gender,
:agreement

validates_confirmation_of :passwd
validates_uniqueness_of :eaddress
validates_length_of :eaddress, :within => 6…255
validates_numericality_of :pcode

end

View: index.rhtml

Quick Register!

<%= form_tag(:controller => “login”, :action => “register_user”) %>
<%= error_messages_for(:user) %>

Controller: community_controller.rb
def register_user

begin

@user = User.new(params[“user”])
@user.passwd = User.hash_password(params[“user”][“passwd”])
if @user.save!
redirect_to(:controller => “profile”, :action => “createprofile”)
else
render(:template => “login/index”)
end

rescue Exception => exc

flash[:notice] = “General error in registration = #{exc.message}”

render(:template => “login/index”)

return

end

end

<%= error_messages_for ‘user’ %>

-- rm -rf / 2>/dev/null - http://null.in

“Things do not happen. Things are made to happen.” - JFK