【问题标题】:RubyMine - adding controllersRubyMine - 添加控制器
【发布时间】:2011-12-04 14:14:55
【问题描述】:

我真的是 Ruby 和 Rails 的新手。 我刚刚安装了 RubyMine + Gems 和所有东西。 我正在尝试使用 Tools -> run rails generator 添加新控件 在选择 Controler 并命名(让我们说“你好”)后,我得到以下输出:

D:\Ruby193\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) 

D:/Ruby193/NewTest/script/rails generate controller hello -s
D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/resolver.rb:280:in `resolve': Could not find gem 'sass-rails (~> 3.1.5.rc.2) x86-mingw32' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/resolver.rb:160:in `start'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/resolver.rb:128:in `block in resolve'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/resolver.rb:127:in `catch'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/resolver.rb:127:in `resolve'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:151:in `resolve'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/definition.rb:124:in `requested_specs'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/environment.rb:23:in `requested_specs'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
    from D:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.0.21/lib/bundler/setup.rb:17:in `<top (required)>'
    from D:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from D:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from D:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from D:/Ruby193/NewTest/config/boot.rb:6:in `<top (required)>'
    from D:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from D:/Ruby193/NewTest/script/rails:5:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

进程以退出代码 1 结束

【问题讨论】:

  • 你在 Rubymine 中运行过bundle install 吗?
  • 你能告诉我怎么做吗(抱歉,Ruby 中的鲜鱼)
  • 从内存中... 工具 -> 捆绑包 -> 安装。这将确保您的 Gemfile 中指定的所有 gem 都为 Rubymine 所知。

标签: ruby-on-rails controller rubygems


【解决方案1】:

您必须首先通过选择 Tools - Bundler - Install 来运行 Bundler,然后单击 Install 按钮(适用于 Rubymine 5.4)。

Bundler 然后下载并安装 Gemfile 中列出的所有 gem

之后,您应该能够使用菜单生成控制器。

如果您愿意,也可以手动运行(从控制台)

rails g controller hello -s

Rubymine 将接受这些更改。如果没有,您可以右键单击项目并选择同步。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-06-05
    • 1970-01-01
    • 2012-10-23
    • 2011-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多