Can anyone explain why a Link_to inside a table <td> should print out the link if the field is null, but print out the field if it contain data(text) in both rails 3 and 2.3.5. If the field is nul it prints out:- "/dsplaces/100? country=UK&area=London" If the field contains data (text) it prints out correctly. The code is:- <td><%= link_to truncate(dsplace.description ,:length => 35), dsplace_path(:id => dsplace.id, :country=> dsplace.country, :area=> dsplace.placename) %></td> -- 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 22, 2010, at 7:36 PM, MDM wrote:> Can anyone explain why a Link_to inside a table <td> should print out > the link if the field is null, but print out the field if it contain > data(text) in both rails 3 and 2.3.5. > > If the field is nul it prints out:- "/dsplaces/100? > country=UK&area=London" > > If the field contains data (text) it prints out correctly. The code > is:- > > <td><%= link_to truncate(dsplace.description ,:length => 35), > dsplace_path(:id => dsplace.id, :country=> dsplace.country, :area=> > dsplace.placename) %></td>Otherwise you''d have nothing to click on. Is this dsplace.description blank, perhaps? -Rob Rob Biedenharn Rob-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org http://AgileConsultingLLC.com/ rab-/VpnD74mH8+00s0LW7PaslaTQe2KTcn/@public.gmane.org http://GaslightSoftware.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.
Thanks for that I will put in an if !=null or make sure the field is not empty On Nov 23, 2:19 am, Rob Biedenharn <R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org> wrote:> On Nov 22, 2010, at 7:36 PM, MDM wrote: > > > Can anyone explain why a Link_to inside a table <td> should print out > > the link if the field is null, but print out the field if it contain > > data(text) in both rails 3 and 2.3.5. > > > If the field is nul it prints out:- "/dsplaces/100? > > country=UK&area=London" > > > If the field contains data (text) it prints out correctly. The code > > is:- > > > <td><%= link_to truncate(dsplace.description ,:length => 35), > > dsplace_path(:id => dsplace.id, :country=> dsplace.country, :area=> > > dsplace.placename) %></td> > > Otherwise you''d have nothing to click on. Is this dsplace.description > blank, perhaps? > > -Rob > > Rob Biedenharn > R...-xa9cJyRlE0mWcWVYNo9pwxS2lgjeYSpx@public.gmane.org http://AgileConsultingLLC.com/ > r...-/VpnD74mH8+00s0LW7PaslaTQe2KTcn/@public.gmane.org http://GaslightSoftware.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.