な・なんと、Rail3.1からは、JQueryがデフォルトになっていると...
ナので、アプリから作り直しました(涙)
rails new aplname -d mysql --skip-bundle
cd aplname
bundle install --path vendor/bundle
:
Installing execjs (1.3.0)
:
Installing jquery-rails (2.0.1)
:
## 何もしないのにインストールされたようです。
■でも、scaffold でエラーになる???
rails g scaffold post title:string body:text
/home/yoru-navi/blog_app/vendor/bundle/ruby/1.9.1/gems/execjs-
1.3.0/lib/execjs/runtimes.rb:50:in `autodetect': Could not find a JavaScript runtime. See
https://github.com/sstephenson/execjs for a list of available runtimes.
(ExecJS::RuntimeUnavailable)
from /home/yoru-navi/blog_app/vendor/bundle/ruby/1.9.1/gems/execjs-1.3.0/lib
/execjs.rb:5:in `<module:ExecJS>'
from /home/yoru-navi/blog_app/vendor/bundle/ruby/1.9.1/gems/execjs-1.3.0/lib
/execjs.rb:4:in `<top (required)>'
:
:
なんで..? therubyracer がインストールされていないなぁ...
◆確認
①bundle list | grep therubyracer
◆インストールしてみる。。
①Gamfile に gem therubyracer を追加して、
②bundle install
③scaffold を再実行。 →できた!!
■ここまでの作業をまとめると...(ブログっぽいAPLを作る)
①rails new aplname -d mysql --skip-bundle
②cd aplname
③vi Gamfile -> gem therubyracer を追加。
④bundle install
⑤vi config/database.yml
-> 11 development:
12 adapter: mysql2
13 encoding: utf8
14 reconnect: false
15 database: aplname_development
16 pool: 5
17 username: dbuser # DBMで生成
18 password: dbpass # DBMで生成
19 socket: /var/lib/mysql/mysql.sock
⑥rake db:create
⑦rails g scaffold post title:string body:text #ブログ投稿機能生成⑧rake db:migrate
⑨rake #テストしてみる
-> :
Finished in 0.001814 seconds.
0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
:
0 件のコメント:
コメントを投稿