Where do you extend classes in your rails application?

Posted by ro on Stack Overflow See other posts from Stack Overflow or by ro
Published on 2010-05-30T14:23:15Z Indexed on 2010/05/30 14:32 UTC
Read the original article Hit count: 252

Just about to extend the Array class with the following extension:

class Array
  def shuffle!
    size.downto(1) { |n| push delete_at(rand(n)) }
    self
  end
end

However, I was wondering where a good place to keep these sort of extensions. I was thinking environment.rb or putting in its own file in the initializers directory.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby