How to use Ruby on Rails functions within plain (non ROR) Ruby file

Viewed 59

Ruby on Rails contains some very useful functions like blank? and date time functions that are not present in vanilla ruby.

What is the gem to enables these and how do I use it?

1 Answers

The gem you are referring to is ActiveSupport and the features can be loaded all at once from core_ext.rb (which loads each file in the core_ext Directory) e.g.

require 'active_support/core_ext'

or loaded individually based the features and classes you are interested in e.g.

require 'active_support/core_ext/object/blank'
Related