How to write "If RAILS code"


#1

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


#2

I suppose you could do a

unless defined? RAILS_ROOT
# Do non Rails code
end

Martin