Forum: Ruby on Rails Modify beginning_of_week?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
007bac1f27905cd4d5d88315e9b0093a?d=identicon&s=25 Guillaume Loader (loader)
on 2009-02-27 01:58
Hello everyone!

Is it possible to modify this function: beginning_of_week?

What I want is something like this :
beginning_of_week(0) returns Sunday
beginning_of_week(1) returns Monday


Thank you!
648a71a35ce6e4a1c5cd63451a2a20df?d=identicon&s=25 Gavin (Guest)
on 2009-02-27 10:24
(Received via mailing list)
What's the argument that you're passing the method?

Just an integer?

On Feb 27, 12:58 am, Guillaume Loader <rails-mailing-l...@andreas-
10f7e00c1c5c60e2173995eb16f4ffc7?d=identicon&s=25 pepe (Guest)
on 2009-02-27 20:53
(Received via mailing list)
I see 2 ways you could do this

1. Re-open the class that offers the functionality and add your code
to modify the behavior. I would not recommend that. I like leaving
code that I didn't write as it is.
2. Create something very simple that receives the parameter you need
and acts accordingly to use the existing beginning_of_week behavior
and get what you want.

On Feb 26, 7:58 pm, Guillaume Loader <rails-mailing-l...@andreas-
This topic is locked and can not be replied to.