Rails3.2.3を動かすまでにつまずいたこと
Railsでまずプロジェクトを作成しようとして速攻つまずきました。。。
【追記】環境を全く書いていなかったので書いておきます。
・CentOS 5.7
・ruby 1.9.3p125
・Rails 3.2.3
・gem 1.8.21
# rails new <プロジェクト名>
と、実行したら以下の様なエラーが・・・
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- openssl (LoadError)
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/lib/ruby/1.9.1/net/https.rb:22:in `<top (required)>'
<中略>
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.1.3/bin/bundle:13:in `<main>'
Fetching gem metadata from https://rubygems.org/.Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Please include the full output of the command, your Gemfile and Gemfile.lock. Thanks!
結局、Rubyをコンパイルする前に、いかのパッケージをインストールしました。
#sqliteはいらなかったかもな~。。
openssl-devel.x86_64
上記をインストールし、rubyを再インストールしたらうまくいきました。
【追記】
# rails new <プロジェクト名>
をしたあとに、出来るGemsfileに以下を追記
gem 'execjs'
gem 'therubyracer'
プロジェクトのディレクトリに移動し、以下のコマンドを実行
# rails generate scaffold <コントローラ名> <カラム名>:型 …
ここで、scaffordを行った時にエラーが出てしまい以下のパッケージもインストールした。
# rake db:migrate
# rails server
にアクセス、アクセスできたら
http://localhost:3000/<コントローラ名>s
にアクセス。CRUD操作出来るWeb画面が表示されるはずです!