错误:Rake Aborted。未初始化的常量设置

时间:2016-01-03 22:00:13

标签: ruby-on-rails ruby development-environment

新手在这里尝试为项目创建开发环境。我已经在我的设备上安装了MySQL和Ruby on Rails。但是,在"捆绑安装"之后尝试运行以下3个命令时,我遇到了以下错误消息。运行成功。有什么想法吗?

  1. bundle exec rake db:setup RAILS_ENV="development"
  2. bundle exec rake db:migrate RAILS_ENV="development"
  3. bundle exec rake db:seed RAILS_ENV=“development"
  4. 错误信息如下:

    wcai-projects already exists
    rake aborted!
    uninitialized constant Settings
    

    编辑 - 这是控制台日志:

    $ bundle exec rake db:setup RAILS_ENV=development
    /.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-3.2.12/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
    wcai-projects already exists
    rake aborted!
    uninitialized constant Settings
    /wcai-web/config/initializers/carrier_wave.rb:4:in `block in <top (required)>'
    /wcai-web/config/initializers/carrier_wave.rb:1:in `<top (required)>'
    /wcai-web/config/environment.rb:5:in `<top (required)>'
    Tasks: TOP => db:setup => db:schema:load_if_ruby => environment
    (See full trace by running task with --trace)
    

    config / initializers / carrier_wave.rb的编辑内容:

    CarrierWave.configure do |config|
      config.fog_credentials = {
        :provider               => 'AWS',       # required
        :aws_access_key_id      => Settings.aws_access_key,      # required
        :aws_secret_access_key  => Settings.aws_secret_key       # required
    #    :region                 => 'eu-west-1'  # optional, defaults to 'us-east-1'
      }
      config.fog_directory  = Settings.aws_bucket                    # required
      config.fog_public     = false     
      config.fog_authenticated_url_expiration = 120
      config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}  # optional, defaults to {}
      #config.asset_host     = 'https://assets.example.com'            # optional, defaults to nil
    
    end
    

1 个答案:

答案 0 :(得分:1)

bundle update rails中的Rails版本更新为4.2.4。然后输入myprop = 20并重试。