Sibu Stephen
Sibu Stephen

Reputation: 11

Sinatra changing default Directory apart from 'public/img'

In Sinatra application how to change the default directory path when concerned with taking images form another folder apart from the default directory '/public/images'?

Upvotes: 0

Views: 461

Answers (1)

dax
dax

Reputation: 10997

You can use the :root option

:root - The application’s root directory

The directory used as a base for the application. By default, this is assumed to be the directory containing the main application file (:app_file setting). The root directory is used to construct the default :public_folder and :views settings. A common idiom is to set the :root setting explicitly in the main application file as follows:

set :root, File.dirname(__FILE__)

Read more here

Upvotes: 1

Related Questions