Is it guaranteed that if you submit a form to a Rails action, and you have a text field with no data in it, that the resulting entry in the params hash for that text field will have value '''' (empty string) instead of nil? I seem to have one page that submits one way (param is '''') and another the other way (param is nil). Thanks, Wes -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sh*t - I found it :). One page was doing a POST and the other was doing a GET (because I had some fancy-assed Javascript submitting my form and I assumed that I could just get away with a plain <FORM> tag in my page, not realizing that the method for the form submission would default to GET). Once I changed the form in the 2nd page to do a POST, all the behavior was consistent. Sigh. But...the good news is that now I know that a text field in a form which doesn''t get any text typed into it will show up as nil in params if you do a GET and as '''' in params if you do a POST. I''m glad I found it - I was starting to go mad. Wes -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Wes Gamble wrote:> Sh*t - I found it :). > > One page was doing a POST and the other was doing a GET (because I had > some fancy-assed Javascript submitting my form and I assumed that I > could just get away with a plain <FORM> tag in my page, not realizing > that the method for the form submission would default to GET). Once I > changed the form in the 2nd page to do a POST, all the behavior was > consistent. > > Sigh. > > But...the good news is that now I know that a text field in a form which > doesn''t get any text typed into it will show up as nil in params if you > do a GET and as '''' in params if you do a POST. > > I''m glad I found it - I was starting to go mad. > > WesIf you are only starting to go mad now, then how did you become a programmer in the first place? :) jp -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeff Pritchard wrote:> If you are only starting to go mad now, then how did you become a > programmer in the first place? > > :)Amen, brother. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---