User (id, username, user_type, master_id) Item ( id,itemname,master_id)
Repairs (id, in_date, out_date, user_id, item_id)
The app is small so I have tried keeping db as simple as possible. A user
can be Admin, Dealer or Manager. A manager can have many dealers under
him(Both stored in same user table).
An Item can be a 'master item' like a computer(with many sub items like
keyboard,mouse) or it can be just a small sub item. So a master item can
have many sub items under it.
A repair is Repair history for item. A repair has an item and user
associated with it.
I have a search for with following parameters ( ALl optional)
- Manager Name
- Dealer Name
- Master Item
- Sub Item
- In date
- Out date
If no 'Dealer Name' is specified I want results to have all Dealers under
the specified 'manager name' included in results, if no 'Sub Item' is
specified I want all items under 'Master Item' to be in the results.
How should the search controller be defined so as to keep code simple and
maintainable? I dont really want to do an 'if' for each condition.
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 firstname.lastname@example.org.
To unsubscribe from this group, send email to email@example.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/QkZv7_s2VX4J.
For more options, visit https://groups.google.com/groups/opt_out.