Where to reopen a class in RoR

Posted by Jeriko on Stack Overflow See other posts from Stack Overflow or by Jeriko
Published on 2010-05-04T14:29:37Z Indexed on 2010/05/04 14:38 UTC
Read the original article Hit count: 206

Filed under:
|

I'm attempting to reopen the String class in rails and add a bunch more methods for my app to use. Writing the code isn't a problem - my question is rather about where this code should go.

It doesn't make sense to me to reopen a class inside a different model file, because it really has nothing to do with any of the models specifically. I thought perhaps somewhere in config or lib would make sense, but I'm not particularly well versed with RoR yet.

To summarize, where would be the most logical place to define class-modifying code?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails