4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Sinatra::Application.environment に staging が追加できない

Posted at

Sinatra::Application.environment に staging が追加できなくてもやもやしてたら

NG

require 'sinatra/base'
require 'sinatra/config_file'

class MyApp < Sinatra::Base

  set :root, File.dirname(__FILE__)
  set :environments, %w{development test production staging}

  register Sinatra::ConfigFile
  config_file 'path/to/config.yml'

  get '/' do
    settings.hello
  end

end

OK

require 'sinatra/base'
require 'sinatra/config_file'

class MyApp < Sinatra::Base

  register Sinatra::ConfigFile

  set :root, File.dirname(__FILE__)
  set :environments, %w{development test production staging}

  config_file 'path/to/config.yml'

  get '/' do
    settings.hello
  end

end

orz
うそやん......

ちなみに、NGのほうをそのまま実行すると

undefined method `hello' for MyApp:Class (NoMethodError)

的なエラーメッセージになります。。

4
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?