« ドラゴンクエストソード | メイン | みんなはどれくらいフィードを読んでいるか??? »

2007年07月25日

JRubyを使ってみる 其の4

ajax_scaffoldが使えるようにajax_scaffold_generatorをインストール

C:\>jruby -S gem install ajax_scaffold_generator
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed ajax_scaffold_generator-3.1.11

railsコマンドでサンプルアプリ(ここではfoo2)をつくる

C:\JRuby\sample_apps>jruby -S rails foo2
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create script/process
create test/fixtures
create test/functional
create test/integration
create test/mocks/development
create test/mocks/test
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create tmp/pids
create Rakefile
create README
create app/controllers/application.rb
create app/helpers/application_helper.rb
create test/test_helper.rb
create config/database.yml
create config/routes.rb
create public/.htaccess
create config/boot.rb
create config/environment.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/breakpointer
create script/console
create script/destroy
create script/generate
create script/performance/benchmarker
create script/performance/profiler
create script/process/reaper
create script/process/spawner
create script/process/inspector
create script/runner
create script/server
create script/plugin
create public/dispatch.rb
create public/dispatch.cgi
create public/dispatch.fcgi
create public/404.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log

database.ymlをfooからコピー

C:\JRuby\sample_apps>copy C:\JRuby\sample_apps\foo\config\database.yml C:\JRuby\sample_apps\foo2\config\
C:\JRuby\sample_apps\foo2\config\database.yml を上書きしますか? (Yes/No/All): Yes
1 個のファイルをコピーしました。

Ajax足場作成

cd foo2
C:\JRuby\sample_apps\foo2>jruby script\generate ajax_scaffold todos todos
exists test/unit/
exists test/fixtures/
exists app/controllers/
exists app/helpers/
create app/views/todos
exists app/views/layouts/
exists public/images
exists test/functional/
create app/models/todos.rb
create test/unit/todos_test.rb
create test/fixtures/todos.yml
create app/views/todos/_form.rhtml
create app/views/todos/_todos.rhtml
create app/views/todos/_form_messages.rhtml
create app/views/todos/_messages.rhtml
create app/views/todos/_column_headings.rhtml
create app/views/todos/_new_edit.rhtml
create app/views/todos/_pagination_links.rhtml
create app/views/todos/list.rhtml
create app/views/todos/component.rhtml
create app/views/todos/create.rjs
create app/views/todos/destroy.rjs
create app/views/todos/edit.rjs
create app/views/todos/new.rjs
create app/views/todos/update.rjs
create app/views/todos/cancel.rjs
create lib/ajax_scaffold.rb
create app/controllers/todos_controller.rb
create test/functional/todos_controller_test.rb
create app/helpers/todos_helper.rb
create app/views/layouts/todos.rhtml
create public/stylesheets/ajax_scaffold.css
create public/javascripts/ajax_scaffold.js
create public/javascripts/rico_corner.js
create public/images/indicator.gif
create public/images/indicator-small.gif
create public/images/add.gif
create public/images/arrow_down.gif
create public/images/arrow_up.gif

起動

C:\JRuby\sample_apps\foo2>jruby script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-07-25 00:13:54] INFO WEBrick 1.3.1
[2007-07-25 00:13:54] INFO ruby 1.8.5 (2007-06-07) [java]
[2007-07-25 00:13:54] INFO WEBrick::HTTPServer#start: pid=14737862 port=3000

動作確認

http://127.0.0.1:3000/todos/

あれれ???
エラーがでて動かない

C:/usr/local/jruby-1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in `load_missing_constant'
C:/usr/local/jruby-1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in `const_missing'
C:/usr/local/jruby-1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in `const_missing'
C:/usr/local/jruby-1.0/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/inflector.rb:0:in `module_eval'
C:/usr/local/jruby-1.0/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/pagination.rb:195:in `constantize'
C:/usr/local/jruby-1.0/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/pagination.rb:195:in `paginator_and_collection_for'
C:/usr/local/jruby-1.0/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/pagination.rb:130:in `paginate'
app/controllers/todos_controller.rb:40:in `component'
#{RAILS_ROOT}/app/views/todos/list.rhtml:1:in `_run_rhtml_47app47views47todos47list46rhtml'

うーん なんだろ。。。
解決せねば。

Rubyist Magazine出張版正しいRubyコードの―RubyistのRubyistによる、Rubyistとそうでない人のための
青木 峰郎
毎日コミュニケーションズ (2007/03)
売り上げランキング: 30316
おすすめ度の平均: 4.0
4 わかっているといいかも?

投稿者 2ca3 : 2007年07月25日 00:29

コメント

ツッコミしてください




保存しますか?