Forum: Ruby on Rails how to write "If RAILS code"

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
phil (Guest)
on 2005-12-02 17:19
(Received via mailing list)
Is there a good way to see if a class is being executed inside rails?  I
have common code that isn't always run from inside rails, if it's not
rails I need to establish an active record connection manually.  Is
there a
good way to see if the application is rails?


mlists (Guest)
on 2005-12-02 17:48
(Received via mailing list)
I suppose you could do a

unless defined? RAILS_ROOT
	# Do non Rails code

This topic is locked and can not be replied to.