Hi all. I have a web app where by people submit data to the DB. I have a
page that lists the last 5 submissions by the ID number. This allows a
user to click one of the last 5 and it brings up all the data for that
ID. e.g. /posts/121314 Id being 121314 for example. This all works
fine. 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. This bit I am having soo much trouble with.
For example, ideally if a user enters the id number in the box, lets say
it’s 12345 it routes directly to /posts/12345 as this will show the
Also I need that when they enter the company name it searches the db and
then lists all entry id’s that also have this name assigned to them.
Once that bit is done I can continue with making them link to the pages
so i Have a search page within my posts controller as below and when
they enter on the form more so for the company name it send it to the
‘searchshow’ page to lists the entries. Both these are currently empty.
def search end def search show end
any help or pointers in the write direction will be great. I have seen
lots of info regarding search etc but they don’t really cover my needs.
I am new to ruby and rails really as you can tell.