I have an attribute quarter
, which I save in a string form - "2015-1"
, meaning year 2015 and first quarter of the year.
How can I get the range of all dates within this quarter
?
I need it for inclusion validation:
validates :date,
presence: true,
inclusion: { in: something_that_returns_the_range_from_quarter_attr }
I would do it like this: