Method: Rails.public_path

Defined in:
railties/lib/rails.rb

.public_pathObject

Returns a Pathname object of the public folder of the current Rails project, otherwise it returns nil if there is no project:

Rails.public_path
  # => #<Pathname:/Users/someuser/some/path/project/public>


122
123
124
# File 'railties/lib/rails.rb', line 122

def public_path
  application && Pathname.new(application.paths["public"].first)
end