class method
self.public_path
Ruby on Rails 6.0.6
Since v2.2.3Signature
self.public_path()
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>
Source
# File railties/lib/rails.rb, line 111
def public_path
application && Pathname.new(application.paths["public"].first)
end
Defined in railties/lib/rails.rb line 111
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails