Navigating through Mack Application
As described in previous chapter, in your first mack application, there are many files and folders that got generated.
There will be many instances where you want to access files in your application folder (e.g. views, static files, etc.) Of course, you can do it using regular ruby path navigation (i.e. File.join(File.dirname(__FILE__), ...)), but it would make your code look not as clean as it could be.
For that particular reason, we've built a utility module that you can use to access all the well known paths to your application. Here're some example:
# NOTE: The paths are defined in Mack::Paths. Use that module to get the path
# to a specific location in your application.
# Also note that all the methods in Mack::Paths take an array of strings, which will
# be used to build the final file path.
Mack::Paths.public # => {APP_ROOT}/public
Mack::Paths.public("javascripts") # => {APP_ROOT}/public/javascripts
Mack::Paths.images # => {APP_ROOT}/public/images
Mack::Paths.images("foo.jpg") # => {APP_ROOT}/public/images/foo.jpg
For complete set of API for Mack::Paths, please visit Mack Paths API