5
votes
1answer
4k views

how to filter (search) a model with multiple params in hash

this function in my Profile model receive a hash from a search form and should filter the table depending on those values. I guess there is something like a pattern for such a standard behavior, right ...
1
vote
2answers
67 views

How can I refactor this oversized Ruby method into smaller bits and have unit tests for them?

This is the existing code. Clearly way too much is going on in this index method and furthermore it's untested (and hard to test in its current form). def index # @s = "" # @now=DateTime.now ...