I want to change Fixnum to include the a "weekend_days" method:
class Fixnum
def weekend_days
//get correct days
end
end
I want this available in my controllers and models? Obviously, I also need it to work in my tests.
Where is the "rails" appropriate place to put this?
My inclination would be to simply stick this into config/initializers/fixnum.rb. Rails will automatically pick this up during the startup process, so it should be available in the actual app, tests, etc. If you end up using this in several Rails projects, a plugin might be a good choice, too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With