This is probably a dumb question, but are you calling
error_messages_for in your view? The code you''ve shown appears to be
correct...
--Matt Jones
On Jun 19, 1:41 am, Newb Newb
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi ALL...
> I want to show error message when entered authority is invalid.
> I implemented below in my controller
>
> if params[:user_info][:login].empty?
> @user = UserInfo.find_by_login(''admin'')
> @company.authority_id = @user.id
> else
> authority = UserInfo.find_by_login(params[:user_info][:login])
> if authority.nil?
> @approval = true
> @company.check_authority(@approval)#this method will be called since
> authority is invalid
> else
> -//Bz/+gSJx3+BMLem55FKMcKpnep0XL2@public.gmane.org_id = authority.id
> end
> end
>
> in my modal i have below function
> def check_authority(authority)
> puts authority
> if authority == true
> puts "true"
> else
> puts "false"
> end
> puts "check"
> errors.add(:authority_id,"*please enter valid authority name")
if
> authority == true
> end
>
> In this above function it prints the value correctly...
> But it dosenot show the error message...
> What is the reason...
> Any guess or suggestion....
> --
> Posted viahttp://www.ruby-forum.com/.