What's the proper way to determine the environment? Right now I'm using:
class Main < Sinatra::Base
get '/' do
puts self.class.development?
puts self.class.production?
end
end
But it doesn't seem right.
I would use Sinatra::Base.development?
or Sinatra::Base.production?
since that is where the methods are coming from.
self.class.development?
should actually work. These all work for me on Sinatra 1.3.1:
class Main < Sinatra::Base
get '/' do
puts Main.development?
puts self.class.development?
puts settings.development?
puts settings.environment == :development
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With