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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fba04dfe5f677c48caee082d87c15b9f?d=identicon&s=25 phil (Guest)
on 2005-12-02 16: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
using
rails I need to establish an active record connection manually.  Is
there a
good way to see if the application is rails?



Thanks,

phil
4e15730ff4cdc7f042a2b9f357d361f4?d=identicon&s=25 mlists (Guest)
on 2005-12-02 16:48
(Received via mailing list)
I suppose you could do a

unless defined? RAILS_ROOT
	# Do non Rails code
end

Martin
This topic is locked and can not be replied to.