I''ve just upgraded from Rails 3.0.7 to 3.1rc5, and am getting some functional test failures with an existing app. When I call a controllers create or update action. e.g. : post :create, :modelname => update on return, the only integer param passed in has been changed type from e.g. 30 to "30". The other params (strings and a boolean) are ok. This happens for different tests - e.g. whether the create is successful, or fails due to a param failing validation, or the user not being logged in (I use devise), the result is always the same. This makes me suspect that the issue is not something in my controller/ model. Has anything changed in this area in Rails 3.1 ? -- 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.
Colin Law
2011-Aug-11 16:49 UTC
Re: Controller integer param converted to string in 3.1rc5
On 11 August 2011 17:39, sreid <sandy-QqoMRuB2QvA51pO8USHC0gC/G2K4zDHf@public.gmane.org> wrote:> I''ve just upgraded from Rails 3.0.7 to 3.1rc5, and am getting some > functional test failures with an existing app. > > When I call a controllers create or update action. e.g. : > > post :create, :modelname => update > > on return, the only integer param passed in has been changed type from > e.g. 30 to "30". The other params (strings and a boolean) are ok.I thought params were always strings. Possibly (probably?) I am wrong. 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philip Hallstrom
2011-Aug-11 17:38 UTC
Re: Controller integer param converted to string in 3.1rc5
>> I''ve just upgraded from Rails 3.0.7 to 3.1rc5, and am getting some >> functional test failures with an existing app. >> >> When I call a controllers create or update action. e.g. : >> >> post :create, :modelname => update >> >> on return, the only integer param passed in has been changed type from >> e.g. 30 to "30". The other params (strings and a boolean) are ok. > > I thought params were always strings. Possibly (probably?) I am wrong.They''ve always been strings for me. I wonder (haven''t looked) if when one does: post :create, :some_number => 123 If in pre 3.1 rails it wasn''t converting it to a string, but passing them as is. Perhaps 3.1 converts them to a string so it''s identical to how they''d come in from the browser? Just a guess... -- 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.
For clarity, I was referring to the "update" object above being changed (it''s a hash, created by factory girl gems attributes_for method). I guess at some point there is Rails code which converts this to string params for passing to the controller ? Maybe now in 3.1rc1, this also changes the update object ? -- 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.
Matt Jones
2011-Aug-12 11:19 UTC
Re: Controller integer param converted to string in 3.1rc5
On Aug 11, 1:39 pm, sreid <sa...-QqoMRuB2QvA51pO8USHC0gC/G2K4zDHf@public.gmane.org> wrote:> For clarity, I was referring to the "update" object above being > changed (it''s a hash, created by factory girl gems attributes_for > method). > > I guess at some point there is Rails code which converts this to > string params for passing to the controller ? Maybe now in 3.1rc1, > this also changes the update object ?Possibly - but note that passing non-string values to a controller in a functional test is a great way to cause really weird bugs. The live code will DEFINITELY be getting strings, so your controllers should be expecting them that way... --Matt Jones -- 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.
Jack Christensen
2011-Aug-12 13:24 UTC
Re: Re: Controller integer param converted to string in 3.1rc5
On 8/12/2011 6:19 AM, Matt Jones wrote:> > On Aug 11, 1:39 pm, sreid<sa...-QqoMRuB2QvA51pO8USHC0gC/G2K4zDHf@public.gmane.org> wrote: >> For clarity, I was referring to the "update" object above being >> changed (it''s a hash, created by factory girl gems attributes_for >> method). >> >> I guess at some point there is Rails code which converts this to >> string params for passing to the controller ? Maybe now in 3.1rc1, >> this also changes the update object ? > Possibly - but note that passing non-string values to a controller in > a functional test is a great way to cause really weird bugs. The live > code will DEFINITELY be getting strings, so your controllers should be > expecting them that way... >There is a small exception to this. If you are POST''ing XML the values will be typecast.> --Matt Jones >-- Jack Christensen jackc-/SOt/BrQZzMOf2zXYvRtkodd74u8MsAO@public.gmane.org -- 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.