freeze_edge
railsのREVISIONを調べる
意外に知らない人が多い気がする(ドキュメント嫁なのだが...)
rabbitjob:~/work/rails/radiant hitokuro$ ./script/about
About your application's environment
Ruby version 1.8.4 (i686-darwin8.7.1)
RubyGems version 0.9.0
Active Record version 1.14.4
Action Pack version 1.12.5
Action Web Service version 1.1.6
Action Mailer version 1.2.5
Active Support version 1.3.1
Edge Rails revision 5147
Application root /Users/hirokazu/work/rails/radiant
Environment development
Database adapter sqlite3
Database schema version 9
freeze_edgeシル
rabbitjob:~/work/rails/radiant hitokuro$ rake freeze_edge REVISION=5147
Time型のヘルパ
select_timeは面倒でdatetime_selectは日付が消せないので
time_selectを作るかと思ったのですがdatetime_selectから日付が消せるようにしてみる
この辺を参考に
- jdate_helper
http://d.hatena.ne.jp/naoya_t/20060210/1139521526
消えるとです。感動です
<%= datetime_select 'businesshour', 'am', :discard_year => true, :discard_month => true, :discard_day => true %>
しかし...
[yyyy▼]-[hh▼]-[mm▼]
ってオイ
[file:/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/helpers/date_helper.rb]
287 datetime_select = select_year(datetime, options_with_prefix.call(1))
288 datetime_select << select_month(datetime, options_with_prefix.call(2)) unless options[:discard_month]
289 datetime_select << select_day(datetime, options_with_prefix.call(3)) unless options[:discard_day] || options[:discard_month]
290 datetime_select << ' — ' + select_hour(datetime, options_with_prefix.call(4)) unless options[:discard_hour]
291 datetime_select << ' : ' + select_minute(datetime, options_with_prefix.call(5)) unless options[:discard_minute] || options[:discard_hour]
ぁぅ...取りあえず納期もあるので治す
治したというわけでパッチ
287c287,288< datetime_select = select_year(datetime, options_with_prefix.call(1))
- -
> datetime_select = ""
> datetime_select << select_year(datetime, options_with_prefix.call(1)) unless options[:discard_year]
290c291,292< datetime_select << ' — ' + select_hour(datetime, options_with_prefix.call(4)) unless options[:discard_hour]
- -
> datetime_select << ' — ' if datetime_select.nil?
> datetime_select << select_hour(datetime, options_with_prefix.call(4)) unless options[:discard_hour]
取りあえず消えるようにして、時以前に何もselectタグが発生していなければ—を取る様にした
全部discardしてしまうお馬鹿さん避けは無い
そのへんまとめてunit_testも加えたら良いのだな...やっつけでごめん
todo:アップデートしたら治るのか調べて治らないならバグ報告をする
続く
画像のアップロード
画像をアップロードできるようにするとです。
とりあえず方針を決める
- DBに直接埋めるのは嫌なので嫌なときの方法を調べた
http://wiki.rubyonrails.com/rails/pages/HowtoUploadFiles
- リサイズはrmagickでいいのかな
続く
railsとcgiを同居したい
予算が足りなくてしぶしぶcgiが使いたい
VirtualHostで運用しているので複数のrailsアプリを動かすのにlighttpdを使っておきたい
まとめると、
railsへのアクセスは、下のように
http-client -> apach2 -> lighttpd
静的なコンテンツとCGIは下のようにしたい
http-client -> apach2
で、apacheの設定は結果的にはこうなった
ServerName [sitename]
ServerAlias www.[sitename]DocumentRoot /home/sites/[sitename]/htdocs/
ScriptAlias /cgi-bin/ /home/sites/[sitename]/htdocs/cgi-bin/RewriteEngine On
RewriteCond /home/sites/[sitename]/htdocs%{REQUEST_FILENAME} !-F
RewriteRule ^/(.*)$ http://[sitename]:8080/$1 [P,NE,L]
しかし、
RewriteCond %{REQUEST_FILENAME} !-F
では無く↓でないとうまくいかなかった(なんで?)
RewriteCond /home/sites/[sitename]/htdocs%{REQUEST_FILENAME} !-F