Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Travis Eubanks12,566 Points
When to include modules
So If im not working on any framework like Rails and im just simply trying to build a program in ruby... do I have to 'include <Module name>' for every module I want to use for intance like Math and Enumerable? OR is there like a standard library I can INCLUDE that stores all the "standard" libraries kind of like rails does
Raymond Sapida33,049 Points
Ruby has a lot of the basic libraries that most people use. If you're building a program with just Ruby, all the core objects are included but you have to include modules like Enumerable and Comparable.
Outside of that, if you wanted to use methods available in Rails, you could add Rails Active Support which extends some of the Ruby classes. You could add the whole thing or pick which parts you wanted to include for your program. It's the closest thing I know to a Ruby standard library that isn't already included in Ruby.
This is the second time the Active Support extension / gem has been mentioned on the forum. The first time was here (which also mentions ActiveRecord) :
Is there going to be a Ruby course with a deep dive into Active Support coming up eventually in the roadmap?
Article: Some Ways ActiveSupport Helps Ruby Developers:
Instrumenting Your Code With ActiveSupport Notifications:
Some old articles / tutorials on ActiveSupport::Callbacks
Active Support Github:
--by the way, according to this stackoverflow thread, ActiveSupport "ActiveSupport is more separate now in Rails 3":