I''m having a problem, ''cause I wrote the following line in my model "Hi": [code] validates_numericality_of :phone, :only_integer => true, :allow_blank => false, :message => "must be a number" [/code] And in my "new" view, I put: [code] <%= error_messages_for :oi, :header_message => "Erro ao cadastrar usuário." , :message => "Cheque o(s) seguinte(s) campo(s):"%> [/code] Rails notice the error, because I can''t save a Hi object with phone not being a number; but it doesn''t show me the errors that was find. What it should be? Thanks for any help. -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 18 August 2010 13:02, Bla ... <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I''m having a problem, ''cause I wrote the following line in my model > "Hi": > > [code] > validates_numericality_of :phone, :only_integer => true, :allow_blank => > false, :message => "must be a number" > [/code] > > And in my "new" view, I put: > > [code] > <%= error_messages_for :oi,I think that should be hi not oi, and I think you have to put the model name in quotes also, so error_messages_for ''hi'', ..... Colin> :header_message => "Erro ao cadastrar usuário." , > :message => "Cheque o(s) seguinte(s) campo(s):"%> > [/code] > > Rails notice the error, because I can''t save a Hi object with phone not > being a number; but it doesn''t show me the errors that was find. > > What it should be? > > Thanks for any help. > -- > 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@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Yeah, I''m sorry. Actually, I wrote it wrong here, in the forum. It''s: [code] <%= error_messages_for :hi, :header_message => "Error." , :message => "Check the following camps:"%> [/code] -- 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 Aug 18, 2:19 pm, "Bla ..." <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Yeah, I''m sorry. > > Actually, I wrote it wrong here, in the forum. > > It''s: > > [code] > <%= error_messages_for :hi, > :header_message => "Error." , > :message => "Check the following camps:"%> > [/code] >What''s in your controller ? Fred -- 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.
this tag "[code]" and "[/code]" is just to let everyone know where begins and where ends my code. It''s not in my controller... -- 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 18 August 2010 14:19, Bla ... <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Yeah, I''m sorry. > > Actually, I wrote it wrong here, in the forum. > > It''s: > > [code] > <%= error_messages_for :hi, > :header_message => "Error." , > :message => "Check the following camps:"%>The docs at http://api.rubyonrails.org/classes/ActionView/Helpers/ActiveRecordHelper.html#M002221 show the name in quotes, as I suggested in my previous post. So error_messages_for ''hi'', ... have you tried that? Colin> [/code] > > -- > 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@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
I try to put in quotes, but it also doesn''t works... -- 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.
Bla ... wrote:> I try to put in quotes, but it also doesn''t works...Can you paste the content that it renders? Also, does anything scroll by in your server window when you try this? Additionally, wanted to mention that error_messages_for was removed from Rails 3, though available as a plugin. So maybe consider just going with a custom solution now. Here is an snippet that I''ve used, though note it is in HAML, not ERB. # views/shared/_error_messages.html.haml - if target.errors.any? #errorExplanation %h2= "#{pluralize(target.errors.count, ''error'')} prohibited this record from being saved:" %ul - target.errors.full_messages.each do |message| %li= message Then used with # views/thingy/_form.html.haml #errors= render ''shared/error_messages'', :target => @company You get a bit more control over what is going on here and are protected against the imminent removal of the helper. -- 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.