Info

Rails3インストールしたのでscaffoldを使ってみる。

$ rails new blog
      create  
      create  README
      create  Rakefile
      create  config.ru
      create  .gitignore
....
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
$ 
$ cd blog/

$ rails generate scaffold Post id:integer title:string body:text created:date
      invoke  active_record
      create    db/migrate/20110123154529_create_posts.rb
      create    app/models/post.rb
      invoke    test_unit
      create      test/unit/post_test.rb
....
      create      app/helpers/posts_helper.rb
      invoke      test_unit
      create        test/unit/helpers/posts_helper_test.rb
      invoke  stylesheets
      create    public/stylesheets/scaffold.css
$

$ rake db:migrate
(in /Users/dongrikim/Dropbox/Developer/Rails/blog)
rake aborted!
uninitialized constant Bundler
/Users/dongrikim/Dropbox/Developer/Rails/blog/rakefile:4
(See full trace by running task with --trace)
$

エラーだ。 gem bundler インストールする。

$ sudo gem install bundler
$ bundle install

$ rake db:migrate
(in /Users/dongrikim/Dropbox/Developer/Rails/blog)
rake aborted!
uninitialized constant Bundler
/Users/dongrikim/Dropbox/Developer/Rails/blog/rakefile:4
(See full trace by running task with --trace)
$

それでも駄目だ。しょうがないのでtraceを見てみる。

$ rake db:migrate --trace
(in /Users/dongrikim/Dropbox/Developer/Rails/blog)
rake aborted!
uninitialized constant Bundler
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2465:in `const_missing'
/Users/dongrikim/Dropbox/Developer/Rails/blog/config/boot.rb:9
......

どうも古いrakeを参照してるみたい。

$ rake --version
rake, version 0.8.3
$

$ sudo mv /usr/bin/rake /usr/bin/rake.old
$ sudo ln -s /opt/local/bin/rake1.9 /usr/bin/rake
$ rake db:migrate
(in /Users/dongrikim/Dropbox/Developer/Rails/blog)
==  CreatePosts: migrating ====================================================
-- create_table(:posts)
   -> 0.0017s
==  CreatePosts: migrated (0.0020s) ===========================================

$ rails server

rake できたっぽい!

http://localhost:3000/posts/

Comments

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS