I am using a new Rails project & an old established Oracle db using adapter: oracle_enhanced. Would like to be able to have dynamic searches against the db depending upon what info/field(s) is available to search against.
I am trying to get from
http://www.abc.com/order/show?acct_num=a123&po_num=789z
and create an object such as
class Order
attr_reader :customer_name, :acct_num, :order_date, :po_num, :qty.
end
I have the paramaters from the request.query_parameters hashtable.
Now in case I am going down the wrong path what I want to do is use the query string and be able to find all orders where acct_num_in_model = acct_num_from_query_string and po_num_from_model = po_num_from_query_string etc. If something is empty such as po_number then return all that match the acct_number and if acct_num empty all that match that po. I am expecting the following:
abc.com/order/show?acct_num=a123&po_num=789z
to return all orders with acct_num=a123 and po_num=789z
abc.com/order/show?acct_num=a123 to return all orders with acct_num = a123
abc.com/order/show?po_num=789z
to return all orders with po_num = 789z
abc.com/order/show?po_num=789z&qty=6
to return all orders with po_num = 789z & qty=6