```ruby
class Forgery

  def self.dictionaries
    @@dictionaries ||= Dictionaries.new
  end

  def self.formats
    @@formats ||= Formats.new
  end

  def self.rails_root
    if defined?(RAILS_ROOT)
      RAILS_ROOT
    elsif defined?(Rails)
      Rails.root.to_s
    end
  end

  def self.rails?
    !rails_root.nil?
  end

end
```

Change order of Rails checks to avoid Rails 3 deprecation warnings
user
```ruby
class Forgery

  def self.dictionaries
    @@dictionaries ||= Dictionaries.new
  end

  def self.formats
    @@formats ||= Formats.new
  end

  def self.rails_root
    if defined?(Rails)
      Rails.root.to_s
    elsif defined?(RAILS_ROOT)
      RAILS_ROOT
    end
  end

  def self.rails?
    !rails_root.nil?
  end

end
```
assistant