(失敗)NetBeansをRubyに対応させてみる
下記のサイトにアクセスし、該当するバージョンのプラグインをダウンロードする。
http://plugins.netbeans.org/plugin/38549/ruby-and-rails
ダウンロードしたZIPを解凍する。
メニューから[ツール]-[プラグイン]を選んで、プラグインダイアログを表示する。
[ダウンロード済み]タブを選択して、[プラグインの追加]ボタンを押す。
そして、解凍したZIPのupdatesディレクトリで、nbmファイルを全て選択して[開く]
次に、ファイル形式でjarを選択し、org-jruby-jruby.jarを選択して[開く]
以上で、インストール完了。
新規プロジェクト作成時にRubyが選択できるようになっている。
しかし、問題が・・・
Railsで作成した直後のdatabase.ymlは下記のようになっているが、
# SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # default: &default adapter: sqlite3 pool: 5 timeout: 5000 development: <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: db/test.sqlite3 production: <<: *default database: db/production.sqlite3
作成したRailsのアプリからプロジェクトを作成すると、
NetBeansで下記のように書き換えられる。
# MySQL. Versions 4.1 and 5.0 are recommended. # # # Be sure to use new-style password hashing: # http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: db/development.sqlite3_test production: <<: *default database: db/development.sqlite3_production
defaultが無いので、RailsでDB周りの操作をしようとすると、下記のようなエラーがでる。
Psych::BadAlias: Cannot load `Rails.application.database_configuration`: Unknown alias: default
困った。