How to write "If RAILS code"

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

I suppose you could do a

unless defined? RAILS_ROOT
# Do non Rails code
end

Martin

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs