RubyMine - 添加控制器

时间:2011-12-04 14:14:56

标签: ruby-on-rails controller rubygems

我是Ruby和Rails的新手。 我刚刚安装了RubyMine + Gems和所有东西。 我正在尝试使用工具添加新的控件 - >运行轨道发电机 在选择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完成处理

1 个答案:

答案 0 :(得分:1)

首先必须选择Tools - Bundler - Install运行Bundler,然后单击Install按钮(对Rubymine 5.4有效)。

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

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

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

rails g controller hello -s

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