to layout what Hassan wrote a bit. First, you should add a resources route 
to config/routes.rb

   resources :search 

and create a SearchController 

type 

  rake routes 

into the terminal in the root of your application to see which routes you 
will have available with
the above setting. 

form with input field on your search page
-> The user is giving a string with e.g a ID
  Note: you should inform the user what format you are expecting: e.g. a 
string consisting solely of numbers
  Because you are not implementing a full search here 
-> submit the form

now check out the simple implementation 
here: https://gist.github.com/andywenk/a1fa786615a16c08499f

I hope this helps to get the idea. Checkout the Rails guides for in depth 
info at http://guides.rubyonrails.org/routing.html#resources-on-the-web

Cheers

Andy

On Sunday, May 11, 2014 8:14:50 PM UTC+2, Hassan Schroeder wrote:
>
> On Sun, May 11, 2014 at 10:01 AM, Mark Mark 
> <[email protected]<javascript:>> 
> wrote: 
>
> >      However I have a search page which is just a box which asks the 
> > user to either search the ID if known or company name by entering it in 
> > a form_for helper box. 
>
> I would start by TDDing a class/method that will take your various 
> expected inputs and tell them apart. Then use the output of that to 
> generate the appropriate 'where' statement to select what you want 
> from the DB (assuming you don't need anything too sophisticated, 
> e.g. fuzzy search, stemming, etc.). 
>
> After that, easy-peasy, it's just redirects and views. 
>
> HTH, 
> -- 
> Hassan Schroeder ------------------------ [email protected]<javascript:> 
> http://about.me/hassanschroeder 
> twitter: @hassan 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8d35167d-5dbd-45ff-8482-2100ec180f7b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to