rvmで環境設定

ruby1.9.2が入っている状態で,ruby1.8.7を使う必要があったので,rvmでいれてみた.
以下は使ったコマンドのメモ.

gem install rvm
bash < <(curl -s -B https://rvm.beginrescueend.com/install/rvm)
vi .bashrc
rvm install 1.8.7
gem install rails -v 2.3.11

ThinkPadのマウスボタンでUbuntuをスクロール

Ubuntu10.10を使っているのだけれど、ThinkPadのマウスポタンでスクロールができなくて困っていたので調べてみた。

まずは、/usr/share/X11/xorg.conf.d/20-thinkpad.confを新規作成

sudo vi /usr/share/X11/xorg.conf.d/20-thinkpad.conf

そして以下のコードを記述。

Section "InputClass"
Identifier "Trackpoint Wheel Emulation"
MatchProduct "TrackPoint"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "false"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection

これであとは再起動すればOK.

参考URL:
http://d.hatena.ne.jp/hiro_nemu/20100421/1271859786
http://d.hatena.ne.jp/hiro_nemu/20101024/1287898287

Rails3でmysql2のExtensionBuildError

Rails3でbundle installしたときにgem ‘mysql2′で詰まったのでメモ。

エラーは、Gem::Installer::ExtensionBuildErrorというもの。
どうやらmysql-dev的なのが無かったらしい。
そこで、調べて以下を実行してからもう一度bundle installしたら無事mysql2も入った。

sudo apt-get install libmysqlclient-dev

gitで管理しているファイルを一覧表示する

gitで管理しているファイルの一覧を表示するためのコマンドを調べてみたのでメモ

git ls-files

Rails3のRails2からの変更点

Head First Railsを読んでみた.

Railsを使ったことのない人には少し難しいかもしれないけど,とても分かりやすくてよかった.
ただこの本はRails2を使っていて,これをRails3で試すのにいくつか変更点があったのでメモ.

route.rb

map.connect ‘/flights/:flight_id/seats’, :action => ‘flight_seats’, :controller => ’seats’

match ‘flights/:flight_id/seats’, :to => ’seats#flight_seats’

Ajaxメソッド

・link_to_remote() → link_to(:remote => true)

また,periodically_call_remote()はRails3では無くなってしまったらしいので,
代わりにPrototype Legacy Helperというプラグインを入れることで使えるようになる.

Gemfileに以下を記述

gem ‘prototype_legacy_helper’, ‘0.0.0′, :git => ‘git://github.com/rails/prototype_legacy_helper.git’

あとはbundle installすればOK.

詳細を知りたい人はこちらのURLをどうぞ.
http://www.simonecarletti.com/blog/2010/06/unobtrusive-javascript-in-rails-3/
http://curiosity-drives.me/programming/rails/rails3-prototype-legacy-helper/
http://d.hatena.ne.jp/rails_room/20100915/1284567155

次のページ →