The problem with no programming for a while... argh. I am trying to output @errors to my browser window for debugging. I forgot how to do it. I have been trying print and printf but I know it is something else... I am sure you guys know :-).
If I am correct to display the contents of the error object I do: <%= @errors.inspect %> But I get nil.... though if I display errors with: <%= error_messages_for "user" %> I get to see my error messages. What is going on? What am I doing wrong? On 25-May-05, at 9:01 PM, John Kopanas wrote:> The problem with no programming for a while... argh. > > I am trying to output @errors to my browser window for debugging. > I forgot how to do it. I have been trying print and printf but I > know it is something else... I am sure you guys know :-). > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Dmitry V. Sabanin
2005-May-26 01:31 UTC
Re: Displaying Contents of An Object For Debugging
On Thursday 26 May 2005 09:21, John Kopanas wrote:> If I am correct to display the contents of the error object I do: > > <%= @errors.inspect %> > > But I get nil.... though if I display errors with: > > <%= error_messages_for "user" %> > > I get to see my error messages. > > What is going on? What am I doing wrong?Try this: <%= debug @user.errors %> -- sdmitry -=- Dmitry V. Sabanin http://sabanin.ru
ahhh.... errors is apart of the users instance... oops... thanks alot! I have another small thing. I am validating the length of a users nickname using: validates_length_of :nickname, :within => 6..25, :too_long => "please pick a shorter nickname", :too_short => "pretty short nickname you have there!" Now if I display the error message for nickname using this: <%= @user.errors[''nickname''] %> And I get the following error: "is too short (min is 6 characters)" I am assuming that the above is the default message. How can I get my custom messages I set? Thanks On 25-May-05, at 9:31 PM, Dmitry V. Sabanin wrote:> On Thursday 26 May 2005 09:21, John Kopanas wrote: > >> If I am correct to display the contents of the error object I do: >> >> <%= @errors.inspect %> >> >> But I get nil.... though if I display errors with: >> >> <%= error_messages_for "user" %> >> >> I get to see my error messages. >> >> What is going on? What am I doing wrong? >> > Try this: > <%= debug @user.errors %> > > -- > sdmitry -=- Dmitry V. Sabanin > http://sabanin.ru > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >