2

where would I place additions to stdlib classes in a rails project? Let's say something like:

class Date
  def foo
    'foo'
  end
end

I thought about the initializer folder but it somehow felt wrong. Ideas?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Frank
  • 23
  • 2

1 Answers1

2

Quite on the contrary, config/initializers is the right place to put this code. I usually create a folder there and put these extensions into separate files named by the name of the corresponding class (date.rb in your case).

alex.zherdev
  • 23,914
  • 8
  • 62
  • 56