01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
2009 : 01 02 03 04 05 06 07 08 09 10 11 12
2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12
2006 : 01 02 03 04 05 06 07 08 09 10 11 12
2005 : 01 02 03 04 05 06 07 08 09 10 11 12
2004 : 01 02 03 04 05 06 07 08 09 10 11 12
- Rubyist Magazine - RubyOnRails を使ってみる 【第 4 回】 ActionPack
controller.action_name
- あるSEのつぶやき: Ajaxライブラリまとめ
入力チェックだけではないが、いろいろとまとめられている。
上記にはないようだが、当初
- JSValidate
を使おうと思っていたのだが、最終的に、
- フォームの入力エラーを吹き出しで教えてくれる JavaScript
を気に入ったのでこちらを使うことに。
Apache サーバは、CentOS 5.2 で現在パッケージ管理されているバージョンを使う。
# yum info httpd Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp Installed Packages Name : httpd Arch : i386 Version: 2.2.3 Release: 11.el5_1.centos.3 Size : 2.8 M Repo : installed Summary: Apache HTTP Server Description: The Apache HTTP Server is a powerful, efficient, and extensible web server.
# yum list *httpd* Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp Installed Packages httpd.i386 2.2.3-11.el5_1.centos. installed httpd-devel.i386 2.2.3-11.el5_1.centos. installed Available Packages httpd-manual.i386 2.2.3-11.el5_1.centos. base system-config-httpd.noarch 5:1.3.3.3-1.el5 base
# gem install passenger Building native extensions. This could take a while... Building native extensions. This could take a while... Successfully installed fastthread-1.0.1 Successfully installed rack-0.4.0 Successfully installed passenger-2.0.3 3 gems installed Installing ri documentation for fastthread-1.0.1... No definition for dummy_dump No definition for dummy_dump No definition for rb_queue_marshal_load No definition for rb_queue_marshal_dump Installing ri documentation for rack-0.4.0... Installing ri documentation for passenger-2.0.3... Installing RDoc documentation for fastthread-1.0.1... No definition for dummy_dump No definition for dummy_dump No definition for rb_queue_marshal_load No definition for rb_queue_marshal_dump Installing RDoc documentation for rack-0.4.0... Installing RDoc documentation for passenger-2.0.3... ./doc/template/horo.rb:17: warning: already initialized constant FONTS ./doc/template/horo.rb:19: warning: already initialized constant STYLE ./doc/template/horo.rb:213: warning: already initialized constant XHTML_PREAMBLE ./doc/template/horo.rb:221: warning: already initialized constant HEADER ./doc/template/horo.rb:272: warning: already initialized constant FILE_PAGE ./doc/template/horo.rb:300: warning: already initialized constant CLASS_PAGE ./doc/template/horo.rb:338: warning: already initialized constant METHOD_LIST ./doc/template/horo.rb:486: warning: already initialized constant FOOTER ./doc/template/horo.rb:491: warning: already initialized constant BODY ./doc/template/horo.rb:503: warning: already initialized constant SRC_PAGE ./doc/template/horo.rb:531: warning: already initialized constant FR_INDEX_BODY ./doc/template/horo.rb:535: warning: already initialized constant FILE_INDEX ./doc/template/horo.rb:583: warning: already initialized constant CLASS_INDEX ./doc/template/horo.rb:584: warning: already initialized constant METHOD_INDEX ./doc/template/horo.rb:586: warning: already initialized constant INDEX
# passenger-install-apache2-module
The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
PassengerRuby /usr/local/bin/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
Press ENTER to continue.
--------------------------------------------
Deploying a Ruby on Rails application: an example
Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host
to your Apache configuration file, and set its DocumentRoot to
/somewhere/public, like this:
<VirtualHost *:80>
ServerName www.yourhost.com
DocumentRoot /somewhere/public
</VirtualHost>
And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:
/usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/doc/Users guide.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
# for Passenger LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3 PassengerRuby /usr/local/bin/ruby
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin hoge@example.com
DocumentRoot /opt/app/rails_contents_root/public
ServerName app1.example.com
ErrorLog logs/app1-error_log
CustomLog logs/app1-access_log combined
</VirtualHost>
~/.forward に携帯へ転送を行うため、アドレスを記載しておく。
mbox 方式と、Maildir 方式で書き方が違う。
Maildir 方式は、
~/MailDir 転送先メールアドレス- Postfixの ~/.forward の書き方
info に送っているものが何故か root に設定してあるメールアドレスに送られてくる。はて?
ログは以下の通り。
Aug 27 21:03:05 localhost postfix/local[12445]: 9A3AF34803A: to=<target@example.co.jp>, orig_to=<info@example.co.jp>, relay=local, delay=0.04, delays=0.03/0.01/0/0, dsn=2.0.0, status=sent (delivered to maildir)
info: postmasterなるほど、既に alias がきられてたってことか。
CentOS 5.2 にはデフォルトで sendmail が入っている。
これを Postfix に入れ替える。
■ スポール、キューの削除
# /usr/bin/mailq
/var/spool/mqueue is empty
Total requests: 0
空なのでそのまま。# /usr/sbin/sendmail -qで空にしておく。
# service sendmail stop sm-client を停止中: [ OK ] sendmail を停止中: [ OK ]
# chkconfig --list sendmail sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off [root@hoge ~]# chkconfig sendmail off [root@hoge ~]# chkconfig --list sendmail sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# yum list postfix Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp base 100% |=========================| 1.1 kB 00:00 updates 100% |=========================| 951 B 00:00 addons 100% |=========================| 951 B 00:00 extras 100% |=========================| 1.1 kB 00:00 Available Packages postfix.i386 2:2.3.3-2.1.el5_2 updates # yum install postfix Loading "fastestmirror" plugin Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * updates: ftp.iij.ad.jp * addons: ftp.iij.ad.jp * extras: ftp.iij.ad.jp Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package postfix.i386 2:2.3.3-2.1.el5_2 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: postfix i386 2:2.3.3-2.1.el5_2 updates 3.6 M Transaction Summary ============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 3.6 M Is this ok [y/N]: y Downloading Packages: (1/1): postfix-2.3.3-2.1. 100% |=========================| 3.6 MB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: postfix ######################### [1/1] postfix: fatal: config variable inet_interfaces: host not found: localhost Installed: postfix.i386 2:2.3.3-2.1.el5_2 Complete!
# alternatives --config mta 2 プログラムがあり 'mta' を提供します。 選択 コマンド ----------------------------------------------- *+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:2
# diff -u /etc/aliases /etc/aliases.org --- /etc/aliases 2008-08-27 17:52:08.000000000 +0900 +++ /etc/aliases.org 2005-04-26 01:48:42.000000000 +0900 @@ -93,4 +93,4 @@ decode: root # Person who should get root's mail -root: hoge@example.com +#root: marc
# postalias /etc/aliases postalias: fatal: config variable inet_interfaces: host not found: localhostむっ?fatal が出ている。
# /etc/init.d/postfix start Starting postfix: [ OK ] [root@lhoge ~]# /etc/init.d/postfix stop Shutting down postfix: [ OK ]
# chkconfig postfix on [root@hoge ~]# chkconfig --list postfix postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
- リポジトリの更新
# yum check-update- インストールされている全パッケージのアップデート
# yum update
ちょいと設計ミス。
テーブル名を変えたいのだが、どうするのか?
class RenameOldTableName < ActiveRecord::Migration
def self.up
rename_table :old_table_name, :new_table_name
end
def self.down
rename_table :new_table_name, :old_table_name
end
end
モデルとの関連で DB を作り直す時に問題が発生する可能性もある。■ has_many 関連モデルの登録
・dept.employees << Employee.new(:name => 'taka')
・dept.employees.build(:name => 'taka')
・dept.employees.create(:name => 'taka')
- build は新しいオブジェクトを作成して関連に追加するが、DB への保存は行わない。
- create は新しいオブジェクトを作成して関連追加した上で、DB への保存も行う。
- dept が DB に保存されていない状態であればいずれも DB への保存は行われない。
$ svnadmin dump /home/svn_rep > svn_rep_backup_`date +%Y%m%d`
$ svnadmin create /home/svn/svn_rep $ svnadmin load /home/svn/svn_rep < svn_rep_backup_20050401
- Parallels Desktop 3.0 for Mac -パラレルズ・デスクトップ-
Google 先生に聞いてまわっていたが、どうもそうらしい?
HTML タグの input radio の onclick イベントに remote_function を書いて回避する。
レスポンスに使いたいテンプレートが同じコントローラの別のアクションと同名のテンプレートである時には render の :action オプションを使用して表示する。
render :action => 'edit'
2009 : 01 02 03 04 05 06 07 08 09 10 11 12
2008 : 01 02 03 04 05 06 07 08 09 10 11 12
2007 : 01 02 03 04 05 06 07 08 09 10 11 12
2006 : 01 02 03 04 05 06 07 08 09 10 11 12
2005 : 01 02 03 04 05 06 07 08 09 10 11 12
2004 : 01 02 03 04 05 06 07 08 09 10 11 12
最終更新時間: 2009-10-14 00:22