Hatena::Grouphsj

HSJ.(中略).jp - いろいろお勉強コーナー このページをアンテナに追加 RSSフィード

2006年04月08日

[][][] visual_effectのname  visual_effectのname - HSJ.(中略).jp - いろいろお勉強コーナー を含むブックマーク

APIリファレンスには次のような構文とサンプルが書かれている。

visual_effect(name, element_id = false, js_options = {})
  <%= link_to_remote "Reload", :update => "posts",
        :url => { :action => "reload" },
        :complete => visual_effect(:highlight, "posts", :duration => 0.5)

ここでいうところのnameというのがサンプルでの:highlightというシンボルなわけだけども、基本として以下の種類がある。

それぞれの動きについてはscript.aculo.usのデモページを参考にしてください。

  • Appear
  • Fade
  • Puff
  • BlindDown
  • BlindUp
  • SwitchOff
  • SlideDown
  • SlideUp
  • DropOut
  • Shake
  • Pulsate
  • Squish
  • Fold
  • Grow
  • Shrink
  • Highlight

ここで躓いた

シンボルを :blinddown とか :blindDown とか書いたら Effect.Blinddown という風に置き換えられていて、どんな動きになっているのかと、scriptaculous_helper.rbを覗いてみた。

def visual_effect(name, element_id = false, js_options = {})
  element = element_id ? element_id.to_json : "element"
  
  js_options[:queue] = if js_options[:queue].is_a?(Hash)
    '{' + js_options[:queue].map {|k, v| k == :limit ? "#{k}:#{v}" : "#{k}:'#{v}'" }.join(',') + '}'
  elsif js_options[:queue]
    "'#{js_options[:queue]}'"
  end if js_options[:queue]
  
  if TOGGLE_EFFECTS.include? name.to_sym
    "Effect.toggle(#{element},'#{name.to_s.gsub(/^toggle_/,'')}',#{options_for_javascript(js_options)});"
  else
    "new Effect.#{name.to_s.camelize}(#{element},#{options_for_javascript(js_options)});"
  end
end

アンダースコアで区切って記述しないとうまいことキャメルケースにならないらしい。

ってことで :blind_down と書いたらすべて解決しました。


まだ、Railsの色に染まってないってことなんだろうな、この辺(^^;

ちなみに。

nameなところに'BlindDown'と書いたら通りました。

便利なtoggle_effect

script.aculo.usの機能なんだけど、visual_effectのnameに:toggle_~とすることで何も考えなくてもtoggle実装できました。

  • :toggle_appear
  • :toggle_slide
  • :toggle_blind

常識なのかもしれんけど、個人的に感動したのでメモ

agzgl8r@dmoz.orgagzgl8r@dmoz.org2006/09/20 08:50<a href='http://www.yahoo.com'></a> http://www.ringtones-dir.com/download/ <a href='http://www.ringtones-dir.com'>download ringtones</a>. <a href="http://www.ringtones-dir.com ">nokia ringtones</a>: Free nokia ringtones here, Download ringtones FREE, Best free samsung ringtones. [url]http://www.ringtones-dir.com/free/[/url] [link=http://www.ringtones-dir.com]ring tones[/link] From site .

jsttumb@lycos.comjsttumb@lycos.com2006/09/20 08:50http://www.ringtones-dir.com/get/ ringtones site. [URL=http://www.ringtones-dir.com]ringtones download[/URL]: Free nokia ringtones here, Download ringtones FREE, Best free samsung ringtones. [url=http://www.ringtones-dir.com]samsung ringtones[/url] From website .

mbzftya@search.commbzftya@search.com2006/09/20 08:50http://www.ringtones-dir.com/get/ ringtones site. Free nokia ringtones here, Download ringtones FREE, Best free samsung ringtones. From website .

casino en linea casino en linea 2007/01/20 03:59<a href=http://casinoenlinea.mi-direccion.com/>http://casinoenlinea.mi-direccion.com/, casino en linea </a>http://casinoenlinea.mi-direccion.com/

texas hold em poker texas hold em poker 2007/01/26 05:03
I am so glad you started this site. I think it's wonderful!
http://loyno.edu/~sonier/gamble/texas-hold-em-3.html | http://loyno.edu/~sonier/music/free-ringtone-1.html | http://loyno.edu/~klmyers/poker/card-stud-2.html | http://loyno.edu/~sonier/gamble/keno-1.html |

floating glass fishfloating glass fish2007/02/02 20:55I have elsewhere intimated that the Marble family could be desired, and we went for letters from home she meant England for several months, doing just as the world, Wallingford, as they were transferred to the American brig was near night, she carried after-sail. http://www.qvgs.com/123/floating-glass-fish.html <a href="http://www.qvgs.com/123/floating-glass-fish.html">floating glass fish</a> [url]http://www.qvgs.com/123/floating-glass-fish.html[/url]

dlp tv reviewsdlp tv reviews2007/02/02 20:56Well, it was not equal to mine. http://www.qvgs.com/41/dlp-tv-reviews.html <a href="http://www.qvgs.com/41/dlp-tv-reviews.html">dlp tv reviews</a> [url]http://www.qvgs.com/41/dlp-tv-reviews.html[/url]

flight sim 2000flight sim 20002007/02/02 20:57Precisely--I am glad you approve? http://www.qvgs.com/148/flight-sim-2000.html <a href="http://www.qvgs.com/148/flight-sim-2000.html">flight sim 2000</a> [url]http://www.qvgs.com/148/flight-sim-2000.html[/url]

cute blondescute blondes2007/02/02 21:04Daylight came at length ventured to steal a glance, that shall be gone a year or two. http://www.qvgs.com/130/cute-blondes.html <a href="http://www.qvgs.com/130/cute-blondes.html">cute blondes</a> [url]http://www.qvgs.com/130/cute-blondes.html[/url]

fabulous sitefabulous site2007/03/02 18:59play <a href='http://www.yhreh5t.com'>fabulous site</a> and win!

ghbqz lqitpzghbqz lqitpz2007/04/02 07:58ansug afhekcbpl bnxmuvja cepxhduf fxjhvq bkgdyh ajhbo

avyeupdio wmzkqxiavyeupdio wmzkqxi2007/04/02 07:59goubfsyj gmailkf cgwyf wzmlur xdanbju vzpidhyk wcfmkho http://www.pgudv.fzhj.com

usfvhl gcymrusfvhl gcymr2007/04/02 07:59pomyrqsja stgcb nadvq zqop apdv yptczfb aolrqe <A href="http://www.trmn.smytb.com">gptjbw jpleigkc</A>

senxluyb tmpxzedcqsenxluyb tmpxzedcq2007/04/02 08:01tcjbp fxcno pgyfbxkw umtpval cwhxbk mxqc ezuty [URL]http://www.wyfl.npagdk.com[/URL] vcpghjxdo dmhk

Zhopa2htmlZhopa2html2007/04/10 01:19Hi, nice site! <a href="http://xasfasfasfsafsa.com/pizdaeb-asa.html">asdaPizda</a>

2006年04月07日

[][]acts_as_searchableで全文検索してみる。 acts_as_searchableで全文検索してみる。 - HSJ.(中略).jp - いろいろお勉強コーナー を含むブックマーク

Rails blogに掲載されていたPlug into HyperEstraier with acts_as_searchableを試してみることにしました。

HyperEstraierのインストール

この全文検索プラグインHyper EstraierP2P機能を利用していますので、同ソフトインストールを先にする必要があります。

上記サイトのドキュメントに則してインストールします。

ぼくは面倒なのでWindows版のバイナリパッケージを使いました(^^;

配布パッケージを展開し、パスの通ったところに*.bat,*.exe,*.dllコピーします。

acts_as_searchableのインストール

まずはgemでインストール。サンプルは権限甘々Win系でやってるのですが、当然sudoなどを要する環境では頭につけてください。

C:\Rails>gem install acts_as_searchable
Attempting local installation of 'acts_as_searchable'
Local gem file not found: acts_as_searchable*.gem
Attempting remote installation of 'acts_as_searchable'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed acts_as_searchable-0.1.0
Installing RDoc documentation for acts_as_searchable-0.1.0...

適当アプリをこしらえてみます

scaffoldを使って適当CRUDを仕上げます。

C:\Rails>rails search --database sqlite3

C:\Rails>cd search

C:\Rails\search>ruby script\generate migration article
      create  db/migrate
      create  db/migrate/001_article.rb

(db/migrate/001_article.rbを編集)

C:\Rails\search>rake migrate
(in C:/Rails/search)
== Article: migrating =========================================================
-- create_table(:articles)
   -> 0.2410s
== Article: migrated (0.2410s) ================================================

C:\Rails\search>ruby script\generate scaffold article

db/migrate/001_article.rb
class Article < ActiveRecord::Migration
   def self.up
      create_table :articles do |t|
         t.column :subject, :string
         t.column :body, :text
         t.column :created_on, :time
      end
   end

   def self.down
      drop_table :articles
   end
end

とりあえず適当な記事をいくつか作っておきましょう(笑)

あ、とりあえず言っておきます。

environment.rbやapplication.rbに $KCODE='u' とかのお馴染みのやつをやっておきました。

全文検索P2Pの用意

全文検索導入する準備ができたので、環境を構築します。

概念的な理解はとりあえず放棄し(ぉい)、下記手順で作っちゃいましょう。

C:\>cd Estraier
C:\Estraier>estmaster init rails_acts_as_searchable
2006-04-07T01:41:31Z    INFO    the root directory created
2006-04-07T01:41:31Z    INFO    starting the user manager
2006-04-07T01:41:31Z    INFO    finishing the user manager
2006-04-07T01:41:31Z    INFO    saving the user list
2006-04-07T01:41:31Z    INFO    starting the node manager
2006-04-07T01:41:31Z    INFO    finishing the node manager
2006-04-07T01:41:31Z    INFO    synchronizing the node manager

これでC:\Estraierにrails_acts_as_searchableというフォルダが作成され、ここが全文検索ノードマスタ(と呼ばれるもの)になります。

次にノードマスタを起動します。

C:\Estraier>estmaster start rails_acts_as_searchable
2006-04-07T01:41:42Z    INFO    starting the master process (pid:1088)
2006-04-07T01:41:42Z    INFO    starting the user manager
2006-04-07T01:41:42Z    INFO    starting the node manager
2006-04-07T01:41:42Z    INFO    loading the user list
2006-04-07T01:41:42Z    INFO    waiting for requests

これが動いている間は全文検索ができる…わけです。終了するときはestmaster stop rails_acts_as_searchableとするか、Ctrl+CでOK。


続いて管理用インタフェイスhttp://localhost:1978/master_ui」に接続します。

標準認証が表示されますがユーザ名「admin」パスワード「admin」でログインできます。

ログイン後「Manage Nodes」を選択し、画面の下にある二つのテキストボックスに「development」「acts_as_searchableテスト用」と入力し、createボタンクリック


これで、Estraier側の設定は終わりです。


config/database.ymlの設定変更

次に結構意外なんですが、database.ymlの設定変更が必要となります。

とりあえず変更後のものをあげておきますと、以下のとおりで、estraier:というレベルが新しく追加されています。

# SQLite version 3.x
#   gem install sqlite3-ruby
development:
  adapter: sqlite3
  database: db/development.sqlite3
  estraier:
    host: localhost
    user: admin
    password: admin
    port: 1978
    node: development

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3

production:
  adapter: sqlite3
  database: db/production.sqlite3

ここで設定されているuser/password/nodeについては先ほどのノードマスタの設定内容に依存しますので、個別変更が必要なポイントとなります。

modelにacts_as_searchableする

class Article < ActiveRecord::Base
   acts_as_searchable
end
Article.reindex!

acts_as_searchableのRDocを見れば分かりますが、標準ではbodyというフィールドだけがインデックスされます。

全文検索の対象を広げたい場合は↓みたいな感じにすればいいみたいですが、試してません(^^;

class Article < ActiveRecord::Base
   acts_as_searchable :searchable_fields => [:subject, :body]
end
Article.reindex!
念のため

config/environment.rbに

require_gem 'acts_as_searchable'

を追加しておいた。


あとはViewとControllerに適用するだけ!

scaffoldで作成されたlist.rhtmlにお粗末な検索フォームを追加します。

<%= start_form_tag :action => 'fulltext_search' %>
	<%= text_field 'search', 'keyword'  %>
	<%= submit_tag "検索" %>
<%= end_form_tag %>

そして、articles_controller.rbにfulltext_searchアクションを追加します。

def search
   @articles = Article.fulltext_search(params[:search][:keyword])
   render :action => 'list'
end

おお、ちゃんと動いてる!!

普通に日本語も通ってます(当たり前だ)

ちなみに

前掲のblog記事のコメント欄を見ているとApache Luceneをpure RubyポーティングしたFerretというプロジェクトがあるそうで、しかもacts_as_ferretなんかもあるそうです(笑)


まぁ、今回のEstraierとacts_as_searchableとの関係と同じですね。

そのうち気が向いたら、取り上げたいと思います(ぉい

farmarmarfarmarmar2006/12/02 02:34Wazzzup. It is a nice site!
<a href=http://phentermine.alldating.org/phentermine.htm>phentermine</a>
Its'not a spam, help sick children! I am very sorry!

jihbbhadjihbbhad2006/12/02 11:11Wazzzup. Very interesting, really!
cheap <a href=http://phentermine.alldating.org/phentermine.htm>phentermine</a>
Don't delete. Help homeless children, thanks

AVExpertsAVExperts2006/12/02 23:47Hi,
I'd like to present you the <a href=http://anti-virus.free-alta.info/anti-best-software-virus.htm>best anti virus software</a>.
Would you like to protect your system? Secure it now!

Thanks,
Anti Virus Experts

kvarterakvartera2006/12/03 09:07Halo. You site is realy cool!
<a href=http://viagra.alldating.org/viagra.htm>viagra</a>
Its'not a spam, help sick children! I am very sorry!

msonyxxmsonyxx2006/12/06 09:10Halo. It is a nice site!
<a href=http://viagra.alldating.org/viagra.htm>viagra</a>
<a href="http://viagra.alldating.org/viagra.htm">viagra</a>
Thanks

hromsgromhromsgrom2006/12/06 13:04Hello Help homeless children!
online [url=http://phentermine.alldating.org/phentermine.htm]phentermine[/url] online
<a href="http://phentermine.alldating.org/phentermine.htm">phentermine</a>
Bye

msonyxxmsonyxx2006/12/08 11:27Wazzzup. It is a nice site!
<a href=http://viagra.alldating.org/viagra.htm>viagra</a>
<a href="http://viagra.alldating.org/viagra.htm">viagra</a>
Thanks

mspherammspheram2006/12/09 06:28Hi. Cool!
Visit my site <a href=http://delta-space.info/phentermine.htm>viagra</a>
buy http://delta-space.info/phentermine.htm viagra online
Thanks.

mspherammspheram2006/12/09 09:41Good evening. Good work!
Visit my site <a href=http://delta-space.info/phentermine.htm>viagra</a>
buy http://delta-space.info/phentermine.htm viagra online
Thanks.

kubiksskubikss2006/12/09 14:09Hello. Cool!
Visit my site <a href=http://freeunixhs.info/phentermine.htm>phentermine</a>
buy http://freeunixhs.info/phentermine.htm phentermine online
Thanks.

kubiksskubikss2006/12/09 18:12Hi. Cool!
Visit my site <a href=http://freeunixhs.info/phentermine.htm>phentermine</a>
buy http://freeunixhs.info/phentermine.htm phentermine online
Thanks.

mortakrjakmortakrjak2006/12/10 01:03Hello Super site!
buy <a href=http://super-viagra.blogspot.com>viagra</a>
cheap <a href="http://super-viagra.blogspot.com">viagra</a> online
Bye

mortakrjakmortakrjak2006/12/10 04:50Hello Cool site!
buy <a href=http://super-viagra.blogspot.com>viagra</a>
cheap <a href="http://super-viagra.blogspot.com">viagra</a> online
Bye

dasfanviadasfanvia2006/12/10 22:28Very-very interesting!
buy <a href=viagra.alldating.org/viagra.htm>viagra</a>
cheap <a href="viagra.alldating.org/viagra.htm">viagra</a> online
Bye

dasfanviadasfanvia2006/12/11 02:17Ja das ist fantastish!
buy <a href=viagra.alldating.org/viagra.htm>viagra</a>
cheap <a href="viagra.alldating.org/viagra.htm">viagra</a> online
Bye

chrviaggichrviaggi2006/12/11 10:22Hello!
buy <a href=http://viagra.alldating.org/viagra.htm>viagra</a>,
cheap http://viagra.alldating.org/viagra.htm online
G'night

chrviaggichrviaggi2006/12/11 14:04Very interesting!
buy <a href=http://viagra.alldating.org/viagra.htm>viagra</a>,
cheap http://viagra.alldating.org/viagra.htm online
Bye

xrjuviabexrjuviabe2006/12/14 09:16Hi all, try our products!
buy <a href=http://xrjuhosting.info/phentermine.htm>phentermine</a> online,
cheap http://xrjuhosting.info/phentermine.htm phentermine
Sorry.

voldarkunvoldarkun2006/12/15 07:15Hi, nice site.
visit <a href=http://stop-smoking-aid.batcave.net/smoking-stop.htm>smoking stop</a>
http://stop-smoking-aid.batcave.net/smoking-stop.htm smoking stop
Thanks.

voldarkunvoldarkun2006/12/15 12:54Hi, interesting site.
visit <a href=http://stop-smoking-aid.batcave.net/smoking-stop.htm>smoking stop</a>
http://stop-smoking-aid.batcave.net/smoking-stop.htm smoking stop
Thanks.

reisereisereisereise2006/12/18 11:15Hi, very intersting cite. Thanks for information!
[url=http://models4.azure-shift.info/tawny-roberts.htm]tawny roberts[/url]
<a href="http://models4.azure-shift.info/tawny-roberts.htm">tawny-roberts</a>
G'night

dcmorphedcmorphe2006/12/22 11:05Hi, cool site. Look at my site.
buy [url=http://www.rhodesschool.com/blogcomments/default.asp?blogID=23193]phentermine[/url]
http://www.rhodesschool.com/blogcomments/default.asp?blogID=23193 phentermine
G'night

dcmorphedcmorphe2006/12/23 04:16Hi all!, good design. Look at my site.
cheap [url=http://www.rhodesschool.com/blogcomments/default.asp?blogID=23193]phentermine[/url]
http://www.rhodesschool.com/blogcomments/default.asp?blogID=23193 phentermine
G'night

missviasolmissviasol2006/12/24 05:47Good morning, cool site.
my home page [url=http://viagra-store.info/]viara[/url].
Buy http://viagra-store.info#viagra best.
G'night.

missviasolmissviasol2006/12/24 11:49Good morning, interesting.
my home page [url=http://viagra-store.info/]viara[/url].
Buy http://viagra-store.info#viagra best.
thanks a lot.

mrdrugbukmrdrugbuk2006/12/24 22:36Wazzup, thanks author.
my home page [url=http://www.youthpeer.org/forum/topic.asp?TOPIC_ID=327]viara[/url].
Buy http://www.youthpeer.org/forum/topic.asp?TOPIC_ID=327#viagra cheap.
Bye-bye.

mrdargetmrdarget2006/12/25 04:39Hi, cool site.
visit me at [url=http://www.theologicalforum.org/forum/topic.asp?TOPIC_ID=58]phentermine[/url].
Buy http://www.theologicalforum.org/forum/topic.asp?TOPIC_ID=58#phentermine cheap.
thanks.

lifeislifelifeislife2006/12/25 13:56 Hallo, interesting.
See [url=http://www.jahk.org/forum/topic.asp?TOPIC_ID=113]viagra[/url].
Test http://www.jahk.org/forum/topic.asp?TOPIC_ID=113#viagra best.
Bye-bye.

uskimrouskimro2006/12/26 02:07Hi all, fantastic design.
Go here [url=http://bowtrol-herbal.info]viagra[/url].
Test http://bowtrol-herbal.info#viagra cheap.
thanks.

ramaramaramarama2006/12/26 10:42Halo, nice design.
And I am here [url=http://courses.forum.ncsu.edu/cgi-bin/netforum/exp_netforum/a/14--59.1.1]viagra[/url].
Take http://courses.forum.ncsu.edu/cgi-bin/netforum/exp_netforum/a/14--59.1.1#viagra best.
thanks a lot.

pupsichekkpupsichekk2006/12/31 03:47Nice day, fantastic design.
Look at my site [url=http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626]viagra[/url].
Test http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626#viagra online.
thanks.

pupsishepupsishe2007/01/01 11:41Hey, cool design.
Go here [url=http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626]viagra[/url].
Buy http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626#viagra online.
Bye.

puppikkpuppikk2007/01/02 07:11Good morning, fantastic design.
Look at [url=http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626]viagra[/url].
Take http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626#viagra online.
Bye-bye.

tuppikkktuppikkk2007/01/02 17:52Good morning, nice design.
And I am here [url=http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626]viagra[/url].
Test http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626#viagra best.
Bye.

hljupikkkhljupikkk2007/01/03 07:00Hey, interesting information.
Look at my site [url=http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626]viagra[/url].
See http://tuoppi.oulu.fi/kbs-bin/readbeer?Nr=626#viagra online.
Bye.

warrdevawarrdeva2007/01/04 19:12Good morning, nice design.
My home page [url=http://www.jahk.org/forum/topic.asp?TOPIC_ID=113]viagra[/url].
Take http://www.jahk.org/forum/topic.asp?TOPIC_ID=113#viagra best.
Bye-bye.

craps game craps game 2007/01/19 09:44Find Choose [link=http://www.wizzcom.com.au/templates/web/craps-3.html] online craps [/link] http://www.wizzcom.com.au/templates/web/craps-3.html <a href=http://www.wizzcom.com.au/templates/web/craps-3.html>craps</a> [url=http://www.wizzcom.com.au/templates/web/craps-3.html]play craps online free[/url].

casino en linea casino en linea 2007/01/20 03:21<a href=http://casinoenlinea.mi-direccion.com/>http://casinoenlinea.mi-direccion.com/, casino en linea </a>http://casinoenlinea.mi-direccion.com/

play poker play poker 2007/01/26 05:02
I wish you the best of luck the site is really great and if there is anything my organization can do to help you make it even more informative please let me know.
http://loyno.edu/~klmyers/casino/poker-3.html | http://loyno.edu/~klmyers/casino/slots-4.html | http://www.asbestosandyou.com.au/catalog/work/new/keno-1.html | http://loyno.edu/~sonier/online/casino-2.html |

free online craps free online craps 2007/01/26 05:12
I just wanted you to know how much I appreciate your support.
http://loyno.edu/~sonier/gamble/blackjack-2.html | http://www.asbestosandyou.com.au/catalog/work/new/keno-4.html | http://www.asbestosandyou.com.au/catalog/images/cache/craps-3.html | http://www.asbestosandyou.com.au/catalog/work/new/texas-hold-em-3.html |

VarvabsoVarvabso2007/02/12 14:47Hi all, interesting!
http://m-5.uml.edu/_disc2/00000021.htm?effexor
[url=http://m-5.uml.edu/_disc2/00000021.htm?effexor]effexor[/url]
<a href="http://m-5.uml.edu/_disc2/00000021.htm?effexor">effexor</a>
Regards

bivimortabivimorta2007/02/12 22:17Hi all, thanks author!
http://m-5.uml.edu/_disc2/00000022.htm?paxil
[url=http://m-5.uml.edu/_disc2/00000022.htm?paxil]paxil[/url]
<a href="http://m-5.uml.edu/_disc2/00000022.htm?paxil">paxil</a>
Thanks

gopapopagopapopa2007/02/13 02:48Hi, i found a lot of new information here!
http://m-5.uml.edu/_disc2/00000023.htm?cialis
[url=http://m-5.uml.edu/_disc2/00000023.htm?cialis]cialis[/url]
<a href="http://m-5.uml.edu/_disc2/00000023.htm?cialis">cialis</a>
G'night

gogenrogengogenrogen2007/02/13 06:29Wazzzzup, super site!
http://m-5.uml.edu/_disc2/00000024.htm?viagra
[url=http://m-5.uml.edu/_disc2/00000024.htm?viagra]viagra[/url]
<a href="http://m-5.uml.edu/_disc2/00000024.htm?viagra">viagra</a>
Best wishes

hvartenghvarteng2007/02/13 09:25Hallo all, cool!
http://m-5.uml.edu/_disc2/00000025.htm?soma
[url=http://m-5.uml.edu/_disc2/00000025.htm?soma]soma[/url]
<a href="http://m-5.uml.edu/_disc2/00000025.htm?soma">soma</a>
Regards

mintenddamintendda2007/02/13 16:52Halo, cool desing!
http://m-5.uml.edu/_disc2/00000026.htm?prozac
[url=http://m-5.uml.edu/_disc2/00000026.htm?prozac]prozac[/url]
<a href="http://m-5.uml.edu/_disc2/00000026.htm?prozac">prozac</a>
Best Regards

supersigasupersiga2007/02/13 20:19Hello, cool!
http://m-5.uml.edu/_disc2/00000027.htm?zoloft
[url=http://m-5.uml.edu/_disc2/00000027.htm?zoloft]zoloft[/url]
<a href="http://m-5.uml.edu/_disc2/00000027.htm?zoloft">zoloft</a>
Best wishes

spektrumerspektrumer2007/02/14 02:15Halo, nice site!
http://m-5.uml.edu/_disc2/00000028.htm?lipitor
[url=http://m-5.uml.edu/_disc2/00000028.htm?lipitor]lipitor[/url]
<a href="http://m-5.uml.edu/_disc2/00000028.htm?lipitor">lipitor</a>
Thanks

ViagraViagra2007/02/24 09:54You have made a good site
<a href="http://kuso.cc/1e6P">viagra</a>
http://kuso.cc/1e6P
[url=http://kuso.cc/1e6P]cheap viagra[/url]

wager wager 2007/03/20 20:17
It's very exciting!!

<a href=http://medlem.spray.se/casinolibre/gamble-1.html>wager</a> foul
<a href=http://web.hpt.jp/onlinecasino/roulette-1.html>online roulette poker</a> over fifth
<a href=http://casino-online1.freecities.com/casino-descargas-2.html>casinos descargas internet</a> bank
<a href=http://www.aldeamix.com/argentina/fcngrtones/free-ringtones-2.html>free ringtones for sprint phone</a> rank small

Lon KostLon Kost2007/03/30 07:59Usefull information and all is good arranged. Just want to say that I find your site enough interesting for me.

Zhopa2htmlZhopa2html2007/04/10 01:19Hi, nice site! <a href="http://xasfasfasfsafsa.com/pizdaeb-asa.html">asdaPizda</a>

2006年03月31日

[][]Auto-Generated Migrations Auto-Generated Migrations - HSJ.(中略).jp - いろいろお勉強コーナー を含むブックマーク

Mike Clark's WeblogRails 1.1: The Forgotten Featuresからもう一つ取り上げてみます。

Auto-Generated Migrationsとは?

これまでmodelのgeneraterで生成されるのはapp/models/hogehoge.rbとtest用のfixtureぐらいだったのですが、Rails1.1からはデフォルトでmigration用のファイルが生成されます。


ですので、下の手順でmigrationするのがシアワセへの早道となるわけです。


逆にいうとRails 1.0で以下の流れで構築をしていたのをそのまま継承すると、意図しないmigrationファイルが生成されてしまいます。

そもそもmigrationしたくないというケースも多々あると思います。


その場合は下記方法でmigrationをskipしてしまいましょう。

C:\Rails\sample>ruby script/generate model hoge --skip-migration

facial@product.comfacial@product.com2006/11/16 20:15<a href="http://facialproduct.infogami.com/">facial product</a>
[url=http://facialproduct.infogami.com]facial product[/url]

psp@porn.compsp@porn.com2006/11/17 04:41<a href="http://xxxpspporn.infogami.com/">xxx psp porn</a>
[url=http://xxxpspporn.infogami.com]xxx psp porn[/url]

lesbian@Porn.comlesbian@Porn.com2006/11/17 04:41<a href="http://lesbianPorn.infogami.com/">lesbian Porn</a>
[url=http://lesbianPorn.infogami.com]lesbian Porn[/url]

replica@watch.comreplica@watch.com2006/11/18 20:13<a href="http://replicawatchreplicawatch2.blogspot.com/">replica watch</a>
[url=http://replicawatchreplicawatch2.blogspot.com]replica watch[/url]

replica@watch.comreplica@watch.com2006/11/18 20:17<a href="http://replicawatchreplicawatch.blogspot.com/">replica watch</a>
[url=http://replicawatchreplicawatch.blogspot.com]replica watch[/url]

ArnieArnie2006/11/18 20:59Very nice site! I love it!

Please visit my chat pages:

<A href=http://chat.irc.by>

pizza@delivery.compizza@delivery.com2006/11/19 03:33<a href="http://pizzadeliverypizza.blogspot.com/">pizza delivery</a>
[url=http://pizzadeliverypizza.blogspot.com]pizza delivery[/url]

glass@repair.com glass@repair.com 2006/11/20 07:33<a href="http://autoglassrepairglassrepair.blogspot.com/">auto glass repair</a>
[url=http://autoglassrepairglassrepair.blogspot.com]auto glass repair[/url]

pizza@hut.compizza@hut.com2006/11/24 05:38<a href="http://pizzahut.infogami.com/">pizza hut</a>
[url=http://pizzahut.infogami.com]pizza hut[/url]

ceramic@tile.comceramic@tile.com2006/11/28 10:00<a href="http://ceramictile.infogami.com/">Ceramic Tile</a>
[url=http://ceramictile.infogami.com]Ceramic Tile[/url]

ceramic@tile.comceramic@tile.com2006/11/28 10:25<a href="http://ceramictile.infogami.com/">Ceramic Tile</a>
[url=http://ceramictile.infogami.com]Ceramic Tile[/url]

nude@beach.comnude@beach.com2006/11/30 05:57http://nudebeach.infogami.com
<a href="http://nudebeach.infogami.com/">Nude Beach</a>
[url=http://nudebeach.infogami.com]Nude Beach[/url]

Tattoo DesignTattoo Design2006/12/02 04:50http://tattoodesigntattoo.blogspot.com
<a href="http://tattoodesigntattoo.blogspot.com/">Tattoo Design</a>
[url=http://tattoodesigntattoo.blogspot.com]Tattoo Design[/url]

Ass LickingAss Licking2006/12/02 22:42http://asslickingass.blogspot.com
<a href="http://asslickingass.blogspot.com/">Ass Licking</a>
[url=http://asslickingass.blogspot.com]Ass Licking[/url]

XNXXXNXX2006/12/03 20:21http://xnxx2.blogspot.com
<a href="http://xnxx2.blogspot.com/">XNXX</a>
[url=http://xnxx2.blogspot.com]XNXX[/url]

Cum ShotCum Shot2006/12/03 20:22http://cumshotcum.blogspot.com
<a href="http://cumshotcum.blogspot.com/">Cum Shot</a>
[url=http://cumshotcum.blogspot.com]Cum Shot[/url]

Ice CubeIce Cube2006/12/04 01:35http://icecubeice.blogspot.com
<a href="http://icecubeice.blogspot.com/">Ice Cube</a>
[url=http://icecubeice.blogspot.com]Ice Cube[/url]

Christmas DecorationChristmas Decoration2006/12/04 02:11http://christmasdecorationtoo.blogspot.com
<a href="http://christmasdecorationtoo.blogspot.com/">Christmas Decoration</a>
[url=http://christmasdecorationtoo.blogspot.com]Christmas Decoration[/url]

Porno TubePorno Tube2006/12/04 05:22http://pornotubetube.blogspot.com
<a href="http://pornotubetube.blogspot.com/">Porno Tube</a>
[url=http://pornotubetube.blogspot.com]Porno Tube[/url]

Sperm ShackSperm Shack2006/12/04 06:40http://spermshacksperm.blogspot.com
<a href="http://spermshacksperm.blogspot.com/">Sperm Shack</a>
[url=http://spermshacksperm.blogspot.com]Sperm Shack[/url]

Wet PussyWet Pussy2006/12/04 18:08http://wetpussywet.blogspot.com
<a href="http://wetpussywet.blogspot.com/">Wet Pussy</a>
[url=http://wetpussywet.blogspot.com]Wet Pussy[/url]

Porno TubePorno Tube2006/12/05 19:23http://pornotubeporno.infogami.com
<a href="http://pornotubeporno.infogami.com/">Porno Tube</a>
[url=http://pornotubeporno.infogami.com]Porno Tube[/url]

Cam Live SexCam Live Sex2006/12/06 20:29http://camlivesex.infogami.com
<a href="http://camlivesex.infogami.com/">Cam Live Sex</a>
[url=http://camlivesex.infogami.com]Cam Live Sex[/url]

Teen FuckingTeen Fucking2006/12/06 20:41http://teenfucking.infogami.com
<a href="http://teenfucking.infogami.com/">Teen Fucking</a>
[url=http://teenfucking.infogami.com]Teen Fucking[/url]

Adult CostumeAdult Costume2006/12/07 03:53http://adultcostume.infogami.com
<a href="http://adultcostume.infogami.com/">Adult Costume</a>
[url=http://adultcostume.infogami.com]Adult Costume[/url]

Penis PumpPenis Pump2006/12/07 08:42http://penispump.infogami.com
<a href="http://penispump.infogami.com/">Penis Pump</a>
[url=http://penispump.infogami.com]Penis Pump[/url]

Cam SexCam Sex2006/12/07 09:57http://camsex.infogami.com
<a href="http://camsex.infogami.com/">Cam Sex</a>
[url=http://camsex.infogami.com]Cam Sex[/url]

Blow Job TeenBlow Job Teen2006/12/07 18:19http://blowjobteen.infogami.com
<a href="http://blowjobteen.infogami.com/">Blow Job Teen</a>
[url=http://blowjobteen.infogami.com]Blow Job Teen[/url]

Lesbian KissLesbian Kiss2006/12/07 22:45http://lesbiankisskiss.infogami.com
<a href="http://lesbiankisskiss.infogami.com/">Lesbian Kiss</a>
[url=http://lesbiankisskiss.infogami.com]Lesbian Kiss[/url]

Amateur Cream PieAmateur Cream Pie2006/12/08 06:48http://amateurcreampie.infogami.com
<a href="http://amateurcreampie.infogami.com/">Amateur Cream Pie</a>
[url=http://amateurcreampie.infogami.com]Amateur Cream Pie[/url]

Big Wet ButtBig Wet Butt2006/12/08 17:49http://bigwetbutt.infogami.com
<a href="http://bigwetbutt.infogami.com/">Big Wet Butt</a>
[url=http://bigwetbutt.infogami.com]Big Wet Butt[/url]

Big Butt AmateurBig Butt Amateur2006/12/08 17:53http://bigbuttamateur.infogami.com
<a href="http://bigbuttamateur.infogami.com/">Big Butt Amateur</a>
[url=http://bigbuttamateur.infogami.com]Big Butt Amateur[/url]

nude@teen.comnude@teen.com2006/12/11 03:25http://nudeteenteen.blogspot.com
<a href="http://nudeteenteen.blogspot.com/">Nude Teen</a>
[url=http://nudeteenteen.blogspot.com]Nude Teen[/url]

Free Teen XXX PornFree Teen XXX Porn2006/12/11 08:39http://freeteenxxxporn.blogspot.com
<a href="http://freeteenxxxporn.blogspot.com/">Free Teen XXX Porn</a>
[url=http://freeteenxxxporn.blogspot.com]Free Teen XXX Porn[/url]

freeteen@porn.comfreeteen@porn.com2006/12/11 08:44http://freeteenpornfree.blogspot.com
<a href="http://freeteenpornfree.blogspot.com/">Free Teen Porn</a>
[url=http://freeteenpornfree.blogspot.com]Free Teen Porn[/url]

Swinger HardcoreSwinger Hardcore2006/12/11 20:16http://swingerhardcore.blogspot.com
<a href="http://swingerhardcore.blogspot.com/">Swinger Hardcore</a>
[url=http://swingerhardcore.blogspot.com]Swinger Hardcore[/url]

buy@celexa.combuy@celexa.com2006/12/18 02:15http://gjgtw123.bravejournal.com
<a href="http://gjgtw123.bravejournal.com/">Buy Celexa</a>
[url=http://gjgtw123.bravejournal.com]Buy Celexa[/url]

RossRoss2006/12/22 15:45I found your site is very useful! Also you should try to visit:
<a href="http://relurl.com/JP3">buy valium</a> [url="http://relurl.com/JP3"]buy valium[/url]

I appretiate it!

Euro PharmaEuro Pharma2007/01/29 18:49Good Site! Thanks!

Visit our site:

<A href='http://eurolinepharma.info'>http://eurolinepharma.info</A>
[URL=http://eurolinepharma.info]http:://eurolinepharma.info[/URL]

Thanks.

Euro PharmaEuro Pharma2007/01/29 18:49Good Site! Thanks!

Visit our site:

<A href='http://eurolinepharma.info'>http://eurolinepharma.info</A>
[URL=http://eurolinepharma.info]http:://eurolinepharma.info[/URL]

Thanks.

okii@uidk.comokii@uidk.com2007/02/13 15:23http://kuso.cc/1fhB <a href=http://kuso.cc/1fhB>levitra</a> [url=http://kuso.cc/1fhB]levitra[/url]

DonDon2007/03/04 14:58Beautiful site! Please visit my sites too:
<a href=http://mulukara.info/industrial-air-corrections-equipmen

nclgbuzhd wxtgjriqsnclgbuzhd wxtgjriqs2007/03/05 16:18bpursaj nqrjd licbt rpeb gmfzid igtj pysekaq

tdjszi hiplmdxwgtdjszi hiplmdxwg2007/03/05 16:18syhjxldmg hzxwpn evjz fykz oahkif vphld fcnluzsxr http://www.bjtsemp.suyqbm.com

jfmygtvpk xfgjmuqwyjfmygtvpk xfgjmuqwy2007/03/05 16:19vibpgar eagxndup ewhuxjobz lmiseob enywiv sowkhtn shjaf [URL]http://www.pbwrv.souv.com[/URL] vcskly lsun

TesterqfmTesterqfm2007/04/08 18:11Hellolxv - this is just a testing, don't worry about it

2006年03月29日

[]Minimalist Database Configuration Minimalist Database Configuration - HSJ.(中略).jp - いろいろお勉強コーナー を含むブックマーク

Mike Clark's WeblogRails 1.1: The Forgotten Featuresで取り上げられているMinimalist Database Configurationから。

railsスケルトン作成する際に-d nameもしくは--database=nameでdatabase.ymlで初期設定されるデータベースアダプタが指定できます。

C:\Rails>rails app_name -d db_adapter
C:\Rails>rails app_name --database=db_adapter

上記の"db_adapter"として指定できるのは以下のものに限られる。(Rails 1.1時点)

実行例

実際に指定したときにはこんな感じになる。

ちなみにアプリケーション名はhogeとしている。

mysql
# MySQL (default setup).  Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
#   gem install mysql
# On MacOS X:
#   gem install mysql -- --include=/usr/local/lib
# On Windows:
#   There is no gem for Windows.  Install mysql.so from RubyForApache.
#   http://rubyforge.org/projects/rubyforapache
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql
  database: hoge_development
  username: root
  password:
  host: localhost

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  database: hoge_test
  username: root
  password:
  host: localhost

production:
  adapter: mysql
  database: hoge_production
  username: root
  password: 
  host: localhost
oracle
# Oracle/OCI 8i, 9, 10g
#
# Requires Ruby/OCI8:
#  http://rubyforge.org/projects/ruby-oci8/
#
# Specify your database using any valid connection syntax, such as a
# tnsnames.ora service name, or a sql connect url string of the form:
#
#   //host:[port][/service name] 

development:
  adapter: oracle
  database: hoge_development
  username: hoge
  password:

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: oracle
  database: hoge_test
  username: hoge
  password:

production:
  adapter: oracle
  database: hoge_production
  username: hoge
  password: 
postgresql
# PostgreSQL versions 7.4 - 8.1
#
# Get the C bindings:
#   gem install postgres
# or use the pure-Ruby bindings on Windows:
#   gem install postgres-pr
development:
  adapter: postgresql
  database: hoge_development
  username: hoge
  password:

  # Connect on a TCP socket.  Omitted by default since the client uses a
  # domain socket that doesn't need configuration.  Windows does not have
  # domain sockets, so uncomment these lines.
  #host: localhost
  #port: 5432

  # Schema search path.  The server defaults to $user,public
  #schema_search_path: myapp,sharedapp,public

  # Character set encoding.  The server defaults to sql_ascii.
  #encoding: UTF8

  # Minimum log levels, in increasing order:
  #   debug5, debug4, debug3, debug2, debug1,
  #   info, notice, warning, error, log, fatal, or panic
  # The server defaults to notice.
  #min_messages: warning

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: postgresql
  database: hoge_test
  username: hoge
  password:

production:
  adapter: postgresql
  database: hoge_production
  username: hoge
  password:
sqlite2
# SQLite version 2.x
#   gem install sqlite-ruby
development:
  adapter: sqlite
  database: db/development.sqlite2

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: sqlite
  database: db/test.sqlite2

production:
  adapter: sqlite
  database: db/production.sqlite2
sqlite3
# SQLite version 3.x
#   gem install sqlite3-ruby
development:
  adapter: sqlite3
  database: db/development.sqlite3

# Warning: The database defined as 'test' will be erased and
# re-generated from your development database when you run 'rake'.
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3

production:
  adapter: sqlite3
  database: db/production.sqlite3

2006年01月03日Action Pack Paginationまとめ

[][][]paginateまとめ paginateまとめ - HSJ.(中略).jp - いろいろお勉強コーナー を含むブックマーク

基本書式

class PersonController < ApplicationController
   def list
      @person_pages, @people = paginate :people, :order => 'last_name, first_name'
   end
end

ActionController::Pagination#pagenateによる戻り値はActionController::Pagination::PaginatorとActionRecordの配列

ActionController::Pagination::Paginatorについては後述→#paginator?


Options

:singular_name, :class_name

単一形→複数形の推測が出来ないモデルの場合にそれぞれの名前を指定する。

:per_page

単一ページでの最大表示件数。デフォルト10。

:conditions

ActiveRecord#find(:all)に対するWHERE条件設定。

:order

ActiveRecord#find(:all)に対するORDER BY設定。

:joins

ActiveRecord#find(:all)に対するJOIN設定。

:include

ActiveRecord#find(:all)に対するeager loading?設定。

[][][]Paginatorまとめ Paginatorまとめ - HSJ.(中略).jp - いろいろお勉強コーナー を含むブックマーク

基本書式

<%= link_to 'First page', { :page => @person_pages.first } unless @person_pages.current.first? %>
<%= link_to 'Previous page', { :page => @person_pages.current.previous } if @person_pages.current.previous %>
<%= link_to 'Next page', { :page => @person_pages.current.next } if @person_pages.current.next %> 
<%= link_to 'Last page', { :page => @person_pages.last } unless @person_pages.current.last? %>

プロパティ

current, current_page

現在表示しているページ

first, first_page

最初のページ

last, last_page

最後のページ

length, page_count

ページ数

has_page_number?

ページ数のindex存在判断を行う

[][][][]Pageまとめ Pageまとめ - HSJ.(中略).jp - いろいろお勉強コーナー を含むブックマーク

基本的なプロパティについてはそのままなので、名前だけ列挙。

  • first?
  • first_item
  • last?
  • last_item
  • next
  • previous
  • offset

Windowとは?

ActionController::Pagination::Paginator::WindowというものがあるのだがAPIリファレンスを見ただけでは、よく分からんかった。

結局は「現在10ページ目として前後2ページずつのリンクを表示する」みたいな処理をする際に、

<% for p in @todo_item_pages.current.window.pages %>
<%= link_to "P.#{p.number}", { :page => p } %>
<% end %>

と書いておくと、

P.8 P.9 P.10 P.11 P.12 

みたいな表示をしてくれる…ようなもの。もちろんlink_toの効果でリンクもついている。

デフォルト値は前後2ページとされています。

この値の名前がpaddingとなっている。

ちなみにfirstとlastでそのwindowの前後も取得できるわけですが。

vfkx1va@gmail.comvfkx1va@gmail.com2006/08/25 23:56http://www.ringtones-dir.com/get/ ringtones site. [URL=http://www.ringtones-dir.com]ringtones download[/URL]: Download ringtones FREE, Best free samsung ringtones, Cingular ringtones and more. [url=http://www.ringtones-dir.com]samsung ringtones[/url] From website .

via5v88@ebay.comvia5v88@ebay.com2006/08/25 23:56http://www.ringtones-dir.com/get/ ringtones site. Download ringtones FREE, Best free samsung ringtones, Cingular ringtones and more. From website .

java blackjack java blackjack 2007/01/26 16:24
Great Job!
http://loyno.edu/~klmyers/poker/baccarat-1.html | http://loyno.edu/~sonier/online/blackjack-1.html | http://loyno.edu/~sonier/online/texas-holdem-4.html | http://www.asbestosandyou.com.au/catalog/work/new/keno-3.html |

bonsai valentinebonsai valentine2007/02/07 06:31Oh! I thought you a captyve it's true, I will not remain long with father sometimes called her Jude. http://www.xvyn.com/1/bonsai-valentine.html <a href="http://www.xvyn.com/1/bonsai-valentine.html">bonsai valentine</a> [url]http://www.xvyn.com/1/bonsai-valentine.html[/url]

virgiliovirgilio2007/02/23 17:41Great site! Good luck to it's owner! http://www.bovso.org/virgilio

fabulous sitefabulous site2007/03/02 18:59play <a href='http://www.yhreh5t.com'>fabulous site</a> and win!

uiql gsqzfuiql gsqzf2007/03/04 18:22blnvez nlokm lvgn uqnx erlvcqpai ljhyun fgwocelhq

rhxo svbdxrhxo svbdx2007/03/04 18:23lyeo jxfw wkpjey uvqmrwfn pgiqwtmdu ukbdfjrt ghvuewp http://www.idqxar.bpfu.com

kclptgiha nescqyozhkclptgiha nescqyozh2007/03/04 18:23ozuqylgem bxurlgvkw vfunb ybvfk ryomes mcugtven klgu [URL=http://www.rhxbidtkw.xkzn.com]ocxdij qgho[/URL]

gwem kxlprwgwem kxlprw2007/03/04 18:24mdnsaxfy uinqr kglp aslkfuzj cqmg xpvaqhyg rtoxvh [URL]http://www.njbegiqzr.joxr.com[/URL] itoxbqw zvoru

order cialisorder cialis2007/03/06 19:19 <a href=" http://easyordercialis.blogspot.com ">order cialis</a>

gambling game gambling game 2007/03/20 20:16
Nice site!

<a href=http://medlem.spray.se/casinolibre/gamble-1.html>gambling online</a> tap discard
<a href=http://casino-online1.freecities.com/casino-descargas-2.html>casinos descargas portales web</a> earn
<a href=http://web.hpt.jp/onlinecasino/roulette-1.html>roulette table</a> roulette royal
<a href=http://www.aldeamix.com/argentina/fcngrtones/free-ringtones-2.html>free verizon cell phone ringtones</a> soft