Topic: Check if a module is included?

Hoi all

I am writing a piece of code that needs to check if Rails.cache is available. This is because the code could be run in a Rails and Non-rails environment and must do a few things differently if that is the case.

1. I thought I would be able to do something Kernel.const_defined?("Rails") but that doesn't work. How would you go about checking if a module is available?

2. Also if there is a better way to see if I am running in a rails environment I would love to know how.

Cheers

RJ

Re: Check if a module is included?

defined?(RAILS_ENV)

?

###########################################
#If i've helped you then please recommend me at Working With Rails:
#http://www.workingwithrails.com/person/ … i-williams

Re: Check if a module is included?

Aha, that does it. Muchos Gracias