Hi Railers, I have put a simple validation validates_length_of :subject, :maximum => 10, :message => "pick a shorter subject" If i have more than 10 characters in subject, the message is not being sent; but on the contrary, when i click on send button it says message sent successfully(a custom message written in Controller) , but in reality it is not getting sent. Why my message pick a shorter subject is not getting reflected. Please advise. Premanshu -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 12, 6:15 am, Premanshu Mishra <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi Railers, > > I have put a simple validation > > validates_length_of :subject, :maximum => 10, :message => "pick a > shorter subject" > > If i have more than 10 characters in subject, the message is not being > sent; > but on the contrary, when i click on send button it says message sent > successfully(a custom message written in Controller) , but in reality it > is not getting sent. Why my message pick a shorter subject is not > getting reflected.Posting some code may help. Are you displaying errors anywhere in your view? Is the "sent successfully" message only being shown if validation is successful? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 12 November 2010 11:15, Premanshu Mishra <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi Railers, > > I have put a simple validation > > validates_length_of :subject, :maximum => 10, :message => "pick a > shorter subject" > > If i have more than 10 characters in subject, the message is not being > sent; > but on the contrary, when i click on send button it says message sent > successfully(a custom message written in Controller) , but in reality it > is not getting sent. Why my message pick a shorter subject is not > getting reflected.What do you mean by ''sent''? The validation check is made when the record is saved to the database not when the form is submitted. I think maybe you have an error in the controller code that is receiving the submit. Colin -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.