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.
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
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
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
end

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