Hi everyone!
I'm currently accomplishing what I want, but I'd like to clean it up a bit. I've placed the following items in an array (please excuse my lack of proper syntax):
@widgets =
[1, red] [2, blue] [3, red] [4, blue]
I'd like to learn a way to search through the @widgets variable an separate the widgets, so that I could have:
@blue_widgets =
[2, blue] [4, blue]
@red_widgets =
[1, red] [4, blue]
...after performing a query on @widgets.
I'm accomplishing this now by doing multiple queries to my database, but I'm sure there's a way to do it by just doing one query, and then separating the data into different variables in my controller. Would that be the best place to do this?
As always, any help is greatly appreciated.