Post date: 2014/03/11 7:33:35
正確には、rails2.3+hobo1.0 からrails4+hobo2.1に移行する
1.alb2をhobo newで作る
2.libは、alb/libにln -s
controllers, helpders, models も../../alb/appのそれぞれにln -s
viewsは、taglibsはそれぞれのdrymlを ../../../../alb/app/views/taglibsのそれぞれにln -s
そのほかは、ディレクトリごとに ../../../alb/app/views以下にln -s
3. rails2.3のalbに、script/plugin install git://github.com/rails/rails_upgrade.git
4. rake rails:upgrade:check を実行して、感触を得る
5. link_to_remoteは、link_to + :remote=>trueにかえる
だけではない、以下が一番詳しい:
http://tech.thereq.com/post/17243732577/rails-3-using-link-to-remote-true-with-jquery-ujs
6. assetsについて
- rake assets:precompile で、public/assets以下にprecompileされたものが入る
- apacheの設定変更
alb_server.confにProxyPass /assets/ ! を加える
/var/www で、ln -s (R1AILS_ROOT)/public/assets assets
- config/environments/production.rbで、config.serve_static_assets = false
7. validatorの正規表現
参照: http://hima-j.in/rails/currybu-update-rails-4/
^ や $ は複数行にマッチするため、脆弱性になってしまう可能性があるということで、 multiline オプションを指定するか、^ は \A に、$ は \z に置き換えましょう
8. Class名とModule名が一緒になった場合
Class名に ::につける。ALBの場合: Model => ::Model
http://stackoverflow.com/questions/4947145/class-and-module-with-the-same-name-how-to-choose-one-or-another
メモ:1. app/views/taglibs/auto を作成する rake hobo:generate_tablibsは、hobo1.3からなくなり、自動生成されるらしい。
しかし、git cloneした場合、autoは.gitignoreされており、rails s では自動生成されない。rake db:migrateすると生成される。
(注意: これでもapp/views/taglibs/auto/admin は作られないようだ。.gitignoreされているなら、コピーするしかない)
2. Hobo2.0.0 を試そうとしてはまったのでメモ
hobo new alb1p6 を作成したが、bundle installで以下のエラー
bundler could not find compatible versions for gem "jquery-rails":
In Gemfile:
hobo_clean (= 2.0.0) ruby depends on
jquery-rails (~> 2.0) ruby
jquery-rails (3.1.0)
この意味は、jquery-railsの最新版をインストールすると3.1.0で、hobo_clean2.0.0のjquery-railsについてのdependency ~>2.0 (2.0.0以上3.0.0未満の最新のものを使用)を満足しない。
対策は、Gemfileで、以下のように jquery-railsにバージョン指定する
gem 'jquery-rails', '~> 2.0.'
3. Ruby2.1.1 は、Hobo2.1で、sign upがうまくいかないバグがある。
https://groups.google.com/forum/#!msg/hobousers/CAmziFYyDW0/FnckXXgwdpkJ
https://github.com/Hobo/hobo/issues/77