On Fri, Jul 6, 2012 at 1:52 PM, sehrguey o. <li...@ruby-forum.com> wrote:
> happy moments are too short... > > the search form worked and still works but it has a major flaw - when > the text_field_tag is left blank then all the db raws pop up on hitting > submit button. > How to prevent it? > > I tried to substitute 'if (search.present?)' for just 'if search' in > disk.rb (the googled out trick seemed so logical) yet it availed of > nothing and all the records were displayed again. > > Now what? > > yours` > sehrguey > This is why you are getting all the records, if there's no "search" then it will find all the records. else find(:all) end You can send an empty array or whatever you want, or maybe you can handle that in the controller Javier Q. -- 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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en-US.