Changing the first day of week in rails

datetime, ruby-on-rails

Solution

Nowadays the method accepts the start day param:

beginning_of_week(start_day = :monday)

Note: param is supported from Rails 4.2.7 only

Problem

I and trying to build a calendar in ruby on rails. In ruby-on-rails, monday is considered to be the first day of the week, but i have to set sunday as the first. I intend to change this to properly use the date's built-in methods RoR. Assuming today is sunday, oct 24th. Look the example: ``` Date.now.beginning_of_week ``` it prints: `2010-10-18` ;but if i could set sunday as the first of the week, it should print : `2010-10-24`

Original source