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 <[email protected]> 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 > �[email protected]_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/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

