<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://www13.atwiki.jp/maimuzo/">
    <title>Ruby on Rails プラグイン まとめ wiki</title>
    <link>http://www13.atwiki.jp/maimuzo/</link>
    <description>Ruby on Rails プラグイン まとめ wiki</description>

    <dc:language>ja</dc:language>
    <dc:date>2011-08-29T14:04:13+09:00</dc:date>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/63.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/62.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/3.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/52.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/46.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/1.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/61.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/13.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/43.html" />
                <rdf:li rdf:resource="http://www13.atwiki.jp/maimuzo/pages/60.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/63.html">
    <title>コメント/acts_as_commentableプラグイン</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/63.html</link>
    <description>
      -good morning - k 2011-08-29 14:04:14      </description>
    <dc:date>2011-08-29T14:04:13+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/62.html">
    <title>Rails用エンジン(Rails Engines)</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/62.html</link>
    <description>
      日本語    </description>
    <dc:date>2010-06-29T15:22:31+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/3.html">
    <title>メニュー2</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/3.html</link>
    <description>
      いづれも実際に自分で買ったもので、オススメなものです。

Ruby on Railsを覚えるならコレです。
#amazon(4798013951,center,text,image)
----
慣れないとちょっと難しいRailsの運用まで書かれているのはコレです。
#amazon(4797335750,center,text,image)
----
Rubyの文法や突っ込んだ仕組みが知りたければコレです。
#amazon(4274066428,center,text,image)

#javascript(){{
var gaJsHost = ((&quot;https:&quot; == document.location.protocol) ? &quot;https://ssl.&quot; : &quot;http://www.&quot;);
document.write(unescape(&quot;%3Cscript src=&#039;&quot; + gaJsHost + &quot;google-analytics.com/ga.js&#039; type=&#039;text/javascript&#039;%3E%3C/script%3E&quot;));
var pageTracker = _gat._getTracker(&quot;UA-1165680-2&quot;);
pageTracker._initData();
pageTracker._trackPageview();
}}

#javascript(){{
&lt;!-- nakanohito --&gt;
&lt;script LANGUAGE=&quot;Javascript&quot;&gt;
&lt;!--
var refer = document.referrer;
document.write(&quot;&lt;a href=&#039;http://nakanohito.jp/&#039;&gt;&quot;);
document.write(&quot;&lt;img src=&#039;http://nakanohito.jp/an/?u=170528&amp;h=737479&amp;w=128&amp;guid=ON&amp;t=&amp;version=js&amp;refer=&quot;+escape(parent.document.referrer)+&quot;&amp;url=&quot;+escape(parent.document.URL)+&quot;&#039; border=&#039;0&#039; width=&#039;128&#039; height=&#039;128&#039; /&gt;&quot;);
document.write(&quot;&lt;/a&gt;&quot;);
//--&gt;
&lt;/script&gt;
&lt;noscript&gt;
&lt;img src=&quot;http://nakanohito.jp/an/?u=170528&amp;h=737479&amp;w=128&amp;guid=ON&amp;t=&quot; width=&quot;128&quot; height=&quot;128&quot; alt=&quot;&quot; border=&quot;0&quot; /&gt;
&lt;/noscript&gt;
&lt;!-- nakanohito end --&gt;
&lt;script type=&quot;text/javascript&quot; charset=&quot;utf-8&quot; src=&quot;http://parts.logoole.yahoo.co.jp/parts/script/h1p3nt24fhcdlo95gfwj9axxswk8eiow&quot;&gt;&lt;/script&gt;&lt;div class=&quot;yahoo-tracks-widget&quot;&gt;&lt;/div&gt;
}}    </description>
    <dc:date>2009-01-08T14:21:09+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/52.html">
    <title>SafeERBプラグイン</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/52.html</link>
    <description>
      **プラグイン名
SafeERBプラグイン

**このプラグインができること
+ERBテンプレートで、&lt;%= ar.hoge %&gt;など、DBや入力パラメータ由来の文字に対して、サニタイズを忘れていたときに例外を出してくれる


**ちょー簡単な使い方
&gt;./script/plugin install http://safe-erb.rubyforge.org/svn/plugins/safe_erb
これだけ。簡単。

**公式ページ
-[[Safe ERB in Ruby on Rails&gt;&gt;http://wiki.rubyonrails.com/rails/pages/Safe+ERB]]

**日本語解説ページ
-ないねぇ。を、[[Ruby札幌の資料&gt;&gt;http://ruby-sapporo.org/events/rsn/6/]]があったか。

**外国語解説ページ
-[[SafeErb for Rails 2&gt;&gt;http://www.rorsecurity.info/2008/01/06/safeerb-for-rails-2/]]

**のうはう
-例外を出すかどうかはtaintという機能(? フラグ?)を使っている
-DBや入力パラメータ由来の文字はtaint状態になっていて、手動でコレを解除するにはstring.untaintとすればよい
-SafeERBプラグインではERB::Util#h(&lt;%=h ar.hoge %&gt;みたいなやつ)とActionView::Helpers::TextHelper#strip_tags(&lt;%= ar.hoge.strip_tags %&gt;みたいなやつ)を拡張しているので、これを使ったときには自動的にuntaintが呼ばれるので例外が発生しない


**コメント
#pcomment(reply)    </description>
    <dc:date>2008-10-09T09:12:53+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/46.html">
    <title>acts_as_commentableプラグイン</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/46.html</link>
    <description>
      **プラグイン名
acts_as_commentableプラグイン

**このプラグインができること
+いろんなモデルにコメント(デフォルトだとタイトルと本文)を付けれる
+ユーザモデルと連動して、
 -特定ユーザがコメントしたコメント一覧
 -特定ユーザがコメントした対象モデル一覧
 -対象モデルへのコメント一覧
を取得可能

**対象バージョン
1.2系　2.0系 2.1系

**ちょー簡単な使い方
&gt;script/plugin install http://juixe.com/svn/acts_as_commentable
でインストールして、マイグレーションしてから
&gt;class Post &lt; ActiveRecord::Base
&gt;  acts_as_commentable
&gt;end
ARにacts_as_commentable入れて
&gt; post.comments &lt;&lt; Comment.new(:title =&gt; titleStr, :comment =&gt; commentStr)　#コメント追加
&gt; post.comments #全コメント
&gt; comments = Comment.find_comments_by_user(userInstance) #特定ユーザのコメント一覧
&gt; postComments = Post.find_comments_by_user(userInstance) #特定ユーザがコメントしたモデル一覧
で幸せに。

**公式ページ
[[Juixe TechKnow » Acts As Commentable Plugin&gt;&gt;http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/]]
※いや、公式かどうかはわからない

**日本語解説ページ
-見つからない

**外国語解説ページ
-良いところがない

**のうはう
-Commentモデルは、このプラグインに付いてくるので、作らなくて良い
-このデフォルトのCommentモデルには、Userモデルへの関連が付いているので、ユーザ情報管理モデルはUserが好ましい。
-プラグインの中のモジュールを読めば解るが、commentsテーブルにはuser_idカラムがあるものの、Userモデルからhas_manyで関連づけする必要はない。特定ユーザが書いたコメントだけ取得したければ、Comment.find_comments_by_user()で絞り込むので、Userモデル側にhas_manyなくても問題無い(User#commentsとかしない)ということ。
-マイグレーションファイルの構造を載せておく
&gt;  class AddRatingTables &lt; ActiveRecord::Migration
&gt;    def self.up
&gt;      create_table :comments, :force =&gt; true do |t|
&gt;        t.column :title, :string, :limit =&gt; 50, :default =&gt; &quot;&quot;
&gt;        t.column :comment, :string, :default =&gt; &quot;&quot;
&gt;        t.column :created_at, :datetime, :null =&gt; false
&gt;        t.column :commentable_id, :integer, :default =&gt; 0, :null =&gt; false
&gt;        t.column :commentable_type, :string, :limit =&gt; 15,
&gt;          :default =&gt; &quot;&quot;, :null =&gt; false
&gt;        t.column :user_id, :integer, :default =&gt; 0, :null =&gt; false
&gt;      end
&gt;      add_index :comments, [&quot;user_id&quot;], :name =&gt; &quot;fk_comments_user&quot;
&gt;    end
&gt;    def self.down
&gt;      drop_table :comments
&gt;    end
&gt;  end
#image(http://farm4.static.flickr.com/3137/2780685717_42b51ba69a.jpg)
[[WWW SQL Designerファイル&gt;http://www13.atwiki.jp/maimuzo?cmd=upload&amp;act=open&amp;pageid=46&amp;file=acts_as_commentable.xml]]

**コメント
#pcomment(reply)    </description>
    <dc:date>2008-10-08T16:54:50+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/1.html">
    <title>トップページ</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/1.html</link>
    <description>
      *Ruby on Rails プラグイン まとめ wiki
today &amp;counter(today) / yesterday &amp;counter(yesterday) / total &amp;counter()
このウィキの最終更新日時は&amp;last_modified()です

**はじめに
-現在フリーでお仕事募集中です。連絡を取りたい方は&amp;link_mail(maimuzo@gmail.com,subject=from_wiki){こちら}までどうぞ。
-このwikiは内容が不足しています。左メニューの更新履歴を追うか、情報元またはその他まとめサイトも見ると幸せになれるかもしれません。
-更新ペースは私の学習ペースです。

**wiki内検索
#search3(title=全文検索,submit=検索する,size=10,ignore=own,or)
※プラグイン一覧を調べたいときは「プラグイン」で検索すると幸せになれるかもしれません。

#tagsearch2(title=タグ検索,submit=検索する,size=10,show_tag_and_page,or)
※プラグイン一覧を調べたいときには「plugin」で検索すると幸せになれるかもしれません。


#include(RubyOnRailsプラグインのカテゴリー)

**その他雑多
-[[maimuzoが個人的にオススメするプラグイン]]
-[[maimuzo的ベストプラクティス]]
-[[その他Ruby系]]
-[[その他Rails系]]
-[[逆引きプラグイン]]
-[[まとめサイト]]
-[[自作Gem]]
-[[WANTED]] (情報お持ちの方教えてください)

**このwikiについて
-このwikiは、Ruby on Rails(以後ROR)のプラグインの種類・用途・完成度などについて、個人のアレコレを元にまとめているものです。
-内容についてはなんら保証ありませんし、このwikiを信じて転んでも責任は被りません。
-プログイン側のバージョンアップなどによって、以前に正解だった内容が、間違いになっている可能性もあります。(Railsの場合多いです)
-最終更新時間を元に自己判断してください。
-既に見つけることが出来るものはそのリンクを、見つけることが出来ないものは試してみるか翻訳したものをまとめる方針です。

**おやくそく・許可など
-メニューに類するページ以外は誰でも書き込み可ですが、公益に反すると管理人が判断した場合は、該当部分を削除しちゃうかもしれません。
-非ログインユーザは編集時にIPを保存します。ただし、当面の間は管理人だけ見ることが出来るようにします。
-悪意のある書き込みと判断した場合にはIPを曝すかもしれません。
-このサイトのコンテンツは、[[Agile Web Development&gt;&gt;http://agilewebdevelopment.com]]からの翻訳コンテンツを含みます。Agile Web Developmentの管理者であるBenjamin Curtisさんから翻訳許可を得ています。
-翻訳コンテンツについても、事実の有無、翻訳の精度、その他一切保証しません。ヘタレな翻訳は突っ込みお願いします。

**特設ページ
Gem関係の情報集約サイトであるgemspec.infoのための特設ページです
-[[GemSpec.info]]


**最近の更新内容
#recent(30)

**[[wikiの使い方]]へ    </description>
    <dc:date>2008-10-07T15:36:10+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/61.html">
    <title>open_id_authenticationプラグイン</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/61.html</link>
    <description>
      **プラグイン名
open_id_authenticationプラグイン

*setup
**何が出来るか
-OpenIDを使ってユーザ登録やログインする処理を作る
-OpenID Providerからの追加属性(メアドとか性別とか)取得サポート(SREG)
-OpenID Providerをホワイトリスト/ブリックリストで制限する
-OpenID URLからOpenID ProviderのURL(Endpoint URL)を調査して、上記ホワイト/ブラックリストに追加するための[[スクリプト&gt;&gt;http://www13.atwiki.jp/maimuzo?cmd=upload&amp;act=open&amp;pageid=61&amp;file=endpoint.rb]]も用意(Maimuzoが適当に作った物)
-open_id_authenticationプラグインは、部品を提供しているに過ぎなく、ジェネレータなどは付いてこないので、基本的に処理は自分で作る必要がある
**方針
-結局、どんな機能が必要で、認証できた/出来なかったときどうしたいかは、アプリ毎に違うので定型化しない方がよい
-でも、フルスクラッチで作ると辛い
-open_id_authenticationを部品として使い、細かいところは自分で作る
-ジェネレータで作るより、コピペでがりがりやる。(ジェネレータ無いし)
-open_id_authenticationプラグイン自体にも手を入れる(そのままだとエラーの振り分けさえ出来ないので)
-下記コードをそのまま動かすには、[[改造版&gt;&gt;http://www13.atwiki.jp/maimuzo?cmd=upload&amp;act=open&amp;pageid=61&amp;file=open_id_authentication.rb]]が必要。これをvender/plugins/open_id_authentication/libに上書きして使う
**標準作業
# sudo gem install ruby-openid
# script/plugin install open_id_authentication
# rake open_id_authentication:db:create
# rake db:migrate
**お好みで
***他の認証系プラグインを使わないならUserモデルを自作する必要がある
# script/generate model User nickname:string email:string claimed_url:string fullname:string birth_date:string gender:integer postcode:string country:string language:string timezone:string
***以下のホワイト/ブラックリスト形式でOpenIDプロバイダに制限を加えるなら、そのリストを作る
# script/generate model TrastedOpenidProvider endpoint_url:string

**ログインしないと見れないページがあるならapp/controllers/application.rbに追加する
class ApplicationController &lt; ActionController::Base
  # 未ログイン状態でログインが必要なページに入ろうとすると、元のページに戻される
  # ログイン専用ページがない場合など
  def block_until_authorized
    unless login?
      flash[:notice] = &quot;Please log in&quot;
      redirect_to(request.referer)
    end
  end

  # ログインが必要なページならば認証ページをはさみ、認証したらそのページに誘導する
  # ログイン専用ページがある場合など
  # 一部
  # http://japan.internet.com/column/developer/20080627/26.html
  # を参考に書き換え必要
  def go_through_authorized
    unless login?
      flash[:notice] = &quot;Please log in&quot;
      # save the URL the user requested so we can hop back to it
      # after login
      session[:jumpto] = request.parameters
      redirect_to(&quot;/login&quot;)
    end
  end
end

**add to app/helper/application_helper.rb
module ApplicationHelper
  def login?
    session[:user_id]
  end

  def logined_user
    User.find(session[:user_id])
  end
end

**ログインが必要なページを指定する
class SomeController &lt; ApplicationController
  before_filter :block_until_authorized,
    :only =&gt; [ :new , :edit, :create, :update, :destroy]

end

**セッションコントローラーの作成
***generate controller
# script/generate controller sessions

***set route to config/routes.rb(RESTful風味)
  map.open_id_complete &#039;session&#039;, :controller =&gt; &quot;sessions&quot;, :action =&gt; &quot;create&quot;, :requirements =&gt; { :method =&gt; :get }
  map.resource :session
  map.login  &#039;/login&#039;,  :controller =&gt; &#039;sessions&#039;, :action =&gt; &#039;new&#039;
  map.logout &#039;/logout&#039;, :controller =&gt; &#039;sessions&#039;, :action =&gt; &#039;destroy&#039;

***paste this controller
class SessionsController &lt; ApplicationController

  # TODO:change default page
  @@default_page = &quot;/&quot;

  # require property from a OpenID provider
  # [:(User model property) =&gt; &quot;(OpenID provider property in sreg)&quot;]
  @@required = {
    :nickname =&gt; &quot;nickname&quot;,
    :email =&gt; &quot;email&quot;
  }

  # optional property from a OpenID provider (sreg)
  # [:(User model property) =&gt; &quot;(OpenID provider property in sreg)&quot;]
  @@optional = {
    :fullname =&gt; &quot;fullname&quot;,
    :birth_day =&gt; &quot;dob&quot;,
    :gender =&gt; &quot;gender&quot;,
    :postcode =&gt; &quot;postcode&quot;,
    :country =&gt; &quot;country&quot;,
    :language =&gt; &quot;language&quot;,
    :timezone =&gt; &quot;timezone&quot;
  }

  # TODO:if your app has an especialy login page, you can use this index action
  # GET /sessions/new
  def new
    #redirect_to :controller =&gt; &quot;TODO::your_logined_user_controller&quot; if login?
    redirect_to default_page
  end

  # POST /sessions
  def create
    if using_open_id?
      open_id_authentication
    else
      flash[:error] = &quot;You must provide an OpenID URL&quot;
      redirect_to tyied_page
    end
  end

  # DELETE /sessions
  # GET    /logout
  def destroy
    session[:user_id] = nil
    redirect_to default_page
  end

protected

  def open_id_authentication
    # request options
    # :whitelist and :blacklist require ActiveRecord class
    # need to modify oepn_id_authentication.rb
    options = {
      :required =&gt; @@required.values.map {|str| str.to_sym},
      :optional =&gt; @@optional.values.map {|str| str.to_sym},
      :whitelist =&gt; TrastedOpenidProvider,
      :target_column =&gt; &quot;endpoint_url&quot;
    }
    authenticate_with_open_id(params[:openid_url], options) do |status, identity_url, registration|
      case status.result
      when :found_in_whitelist_or_blacklist
        failed_login &quot;Sorry, the OpenID server is blocked by the white list&quot;
      when :double_auth
        failed_login &quot;Error, detect a double autentication&quot;
      when :missing
        failed_login &quot;Sorry, the OpenID server couldn&#039;t be found&quot;
      when :canceled
        failed_login &quot;OpenID verification was canceled&quot;
      when :failed
        failed_login &quot;Sorry, the OpenID verification failed&quot;
      when :successful
        if @current_user = User.find_by_claimed_url(identity_url)
          successful_login
        else
          @current_user = User.new
          assign_registration_attributes!(registration)
          @current_user.claimed_url = identity_url
          @current_user.nickname = identity_url.delete(&quot;http://&quot;)[0..8] if @current_user.nickname.blank?

          if @current_user.save
            successful_login
          else
            failed_login &quot;Your OpenID profile registration failed: &quot; +
              @current_user.errors.full_messages.to_sentence
          end
        end
      end

    end
  end

  def successful_login
    session[:user_id] = @current_user.id
    #jumpto = session[:jumpto] || default_page
    #session[:jumpto] = nil
    #redirect_to(jumpto)
    redirect_to(root_url)
  end

  def failed_login(message)
    flash[:error] = message
    redirect_to default_page
  end

   # if you don&#039;t use map.resource in config/routes.rb, you need to use root_url method:
#  def root_url
#    # TODO:check with config/routes.rb
#    open_id_complete
#  end
 
  def default_page
    @@default_page
  end

  def tyied_page
    request.referer
  end

  # registration is a hash containing the valid sreg keys given above
  # use this to map them to fields of your user model
  def assign_registration_attributes!(registration)
    model_to_registration_mapping.each do |model_attribute, registration_attribute|
      unless registration[registration_attribute].blank?
        @current_user.send(&quot;#{model_attribute}=&quot;, registration[registration_attribute])
      end
    end
  end

  # TODO:change this hash like your user model.
  def model_to_registration_mapping
    @@required.merge(@@optional)
  end
    
end



**必要ならapp/views/sessions/new.html.erbを作る
&lt;% if flash[:error] -%&gt;
  &lt;%= flash[:error] %&gt;
&lt;% end -%&gt;
&lt;% form_tag(session_url) do |f| -%&gt;
  &lt;label for=&quot;openid_url&quot; &gt;
    OpenId URL:
  &lt;/label&gt;
  &lt;%= text_field_tag :openid_url -%&gt;
  &lt;%= submit_tag &quot;Login&quot; -%&gt;
&lt;% end -%&gt;


**公式ページ
[[GitHubのページ&gt;&gt;http://github.com/rails/open_id_authentication/tree/master]]
※いや、公式かどうかはわからない

**日本語解説ページ
-[[OpenID系の比較&gt;&gt;http://www13.atwiki.jp/maimuzo/pages/43.html]]

**外国語解説ページ
-良いところがない

**のうはう
-マイグレーションファイルの構造を載せておく
&gt; class AddOpenIdAuthenticationTables &lt; ActiveRecord::Migration
&gt;   def self.up
&gt;     create_table :open_id_authentication_associations, :force =&gt; true do |t|
&gt;       t.integer :issued, :lifetime
&gt;       t.string :handle, :assoc_type
&gt;       t.binary :server_url, :secret
&gt;     end
&gt;     create_table :open_id_authentication_nonces, :force =&gt; true do |t|
&gt;       t.integer :timestamp, :null =&gt; false
&gt;       t.string :server_url, :null =&gt; true
&gt;       t.string :salt, :null =&gt; false
&gt;     end
&gt;   end
&gt;   def self.down
&gt;     drop_table :open_id_authentication_associations
&gt;     drop_table :open_id_authentication_nonces
&gt;   end
&gt; end
#image(http://farm4.static.flickr.com/3285/2861268523_0ae9c2d71b_o.jpg)
[[WWW SQL Designerファイル&gt;http://www13.atwiki.jp/maimuzo?cmd=upload&amp;act=open&amp;pageid=61&amp;file=open_id_authentication.xmll]]

**コメント
#pcomment(reply)    </description>
    <dc:date>2008-10-07T15:35:23+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/13.html">
    <title>セキュリティ(Security)</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/13.html</link>
    <description>
      -[[Acts as Authenticatedプラグイン]]
-[[SafeERBプラグイン]]
-[[open_id_authenticationプラグイン]]    </description>
    <dc:date>2008-10-07T15:19:53+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/43.html">
    <title>逆引きプラグイン</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/43.html</link>
    <description>
      使い分けや逆引き風にまとめたものです。
カテゴリ目次
#contents()

**黙って最初から導入
よく実テーブル上のカラム名や形や長さを忘れてしまうので、[[paginating_findプラグイン]]を使ってmodelにスキーマをメモしています。 
Gemだけど、[[Capistrano]]を使ってデプロイ出来るのと出来ないのでは、開発効率が大きく違います。
Rails1.x系でのPagenateは、機能としては便利なのですがデータの持ち方に癖があるので、あまりそれを応用したプラグインが無かったりします。またRails2.x系だと、そんなこともあってPagenate自体がなくなりました(Rails標準ではなくプラグインを使うことが前提となった)。そんな時に使うのが[[paginating_findプラグイン]]で、これだと標準のfindメソッドを拡張してくれます。

**ログイン処理
***Rails 1.x系
[[Acts as Authenticatedプラグイン]]が標準か?

***Rails 2.x系
これが一番ってのは無いみたい。OpenIDを絡めて比較してみると･･･
|機能|Restful Authentication|open_id_authentication|openid_fu_generator|restful_open_id_authentication_redux|
|ユーザ登録|○|×|○|○|
|ログイン（認証）|○(パスワード)|○（OpenID）|○(パスワード/OpenID)|○(パスワード/OpenID)|
|セッション管理|○|×|○|○|
|アクセス制御|△|×|○|○|
|ログアウト|○|×|○|○|
|アカウント管理|×|×|○|○|
|形態|plugin|plugin|gem|plugin|
|OpenIDの対応バージョン|×|2.0|2.0|?(1.0かも)|
|備考|OpenID使わない場合デファクトスタンダードらしい|シンプルにOpenIDの認証機能だけ提供。普通はRestful Authenticationと組み合わせるらしい|パスワード+OpenIDなら一番しっかりしてる感じがする。細かいところでredux(→)よりよさげなところが見える|Restful Authenticationとopen_id_authenticationが最初から組み合わさっている感じなんだろうか。Rails2.1でも動く|
まーでも、実際に使ってみた訳じゃなくて、ソース追った程度だからね。はまりポイントがあるのかもしれないし。
全部ruby-openidってgemを使ってるのかな(未確認)
→色々はまったので追記
****まずruby-openid
このgemかなり良くできていて、他のプラグインなどはほとんどruby-openidに依存しているんだけど、ruby-openidだけを使って認証システムを作るにはOpenIDに対して精通してないと無理っぽい。各クラスやメソッドの意味とか流れを把握してないと、これだけで組むのは辛いって事。
****次openid_fu_generator
見た目は一番リッチな機能を提供してくれそうなんだけど、バージョン0.0.1からあがってないし、使ってみたらsessionsコントローラのbeginアクションの一番最初の分岐で止まる。ソースを追ったけど、下手に機械的なコードを隠蔽しているせいで、流れを追うのが難しい。結局原因解明できなかったのであきらめ。ちなみにrails2.1.1+ruby-openid2.1.2+openid_fu_generator0.0.1で試してました。
****次open_id_authentication
シンプルにruby-openidのラッパーとして動くみたいだけど、他のプラグインと違うのは、migrationファイルやライブラリは提供するものの、ジェネレータなどは付属してないため、UserコントローラやSessionコントローラを自作する必要があるって事。まぁ、単体で使うことは想定してないんだろうな。
見ておくべきは[[OpenIDとRails：Authentication 2.0&gt;&gt;http://japan.internet.com/column/developer/20080627/26.html]](すばらしすぎ)と、open_id_authenticationのREADMEにサンプルソースがついてるので、それを交互に見ながら何やってるかを追えば、結構簡単に認証処理も作れるっぽい。SREG（Simple Registration Extension for OpenID）の対応もサクッとできそう。ホワイトリスト的に受付可能なOpenID Providerを絞るのも、[[第5回　Railsで作るOpenID対応アプリケーション実践（後編）(3)&gt;&gt;http://gihyo.jp/dev/feature/01/openid/0005?page=3]]の流れでサクッとはじけれそう。(あとはJavaScriptのライブラリとして、受付可能なOpenID Providerをリスト表示してくれるものがあればいいんだけど…)
****参考
-[[Railsで作るOpenID対応アプリケーション実践（前編）&gt;&gt;http://gihyo.jp/dev/feature/01/openid/0004]]
-[[restful_open_id_authentication_redux - Hello, world! - s21g&gt;&gt;http://blog.s21g.com/articles/278]]
-[[Plugins - Open Id Authentication - Agile Web Development&gt;&gt;http://agilewebdevelopment.com/plugins/openidauthentication]]
****データベース構造
#image(http://farm4.static.flickr.com/3128/2861255363_2720fb4450_o.jpg)
#image(http://farm4.static.flickr.com/3285/2861268523_0ae9c2d71b_o.jpg)
#image(http://farm4.static.flickr.com/3143/2861289573_991ef06a4f_o.jpg)
#image(http://farm4.static.flickr.com/3224/2862108466_60deac2bd6_o.jpg)

**ファイルアップロード処理
[[Attachment_fuプラグイン]]が使えるなら使った方が楽かもね。

**レーティング系
acts_as_ratableプラグインが良さそう→否

rails 2.1系でacts_as_rateableが[[エラーを出している&gt;http://agilewebdevelopment.com/plugins/acts_as_rateable]]みたい。あまりスケールしないとも書いてあるなぁ。
となったら、acts_as_ratedがいいのかもしれない。

**タギング系
acts_as_taggable_on_steroidsとacts_as_taggable_reduxが良さそう
使い分けは
-自分で作った何かにタグを付けるならsteroids
-他人が作った何かにタグを付けるならredux
みたい
-[[acts_as_taggable_on_steroidsとacts_as_taggable_reduxの(用途)比較CommentsAdd Star&gt;&gt;http://d.hatena.ne.jp/yotena/20071220/1198103145]]
***データベース構造
#image(http://farm4.static.flickr.com/3227/2861719571_8d709e1430_o.jpg)    </description>
    <dc:date>2008-10-06T15:01:15+09:00</dc:date>
  </item>
    <item rdf:about="http://www13.atwiki.jp/maimuzo/pages/60.html">
    <title>GemSpec.infoのER図</title>
    <link>http://www13.atwiki.jp/maimuzo/pages/60.html</link>
    <description>
      -GemSpec.infoのER図
フィーチャを基にモックとER図をまとめてみました。
ER図の作図は[[WWW SQL Designer&gt;&gt;http://ondras.zarovi.cz/sql/demo/]]というツールを使って描いています。
なんでコレがいいのかといった点は、[[北から南や西を見て思うこと: RubyOnRailsの設計手法もレールに乗せよう&gt;&gt;http://fromnorth.blogspot.com/2008/08/rubyonrails.html]]あたりを参照してください。

さて、ER図を見る方法ですが、[[WWW SQL Designer&gt;&gt;http://ondras.zarovi.cz/sql/demo/]]には画像ファイルへのエクスポート機能のような軟派なものは付いてないので、[[このXML&gt;&gt;http://www13.atwiki.jp/maimuzo?cmd=upload&amp;act=open&amp;pageid=60&amp;file=er.xml]]を[[WWW SQL Designer&gt;&gt;http://ondras.zarovi.cz/sql/demo/]]に食わせて開くのが一番いい気がします。

一応操作方法をメモしておきます。
+[[WWW SQL Designer&gt;&gt;http://ondras.zarovi.cz/sql/demo/]]を開く
+右上のSave/Loadをクリック
+ダイアログが開くので、そこのInput/Outputのテキストエリアに[[XML&gt;&gt;http://www13.atwiki.jp/maimuzo?cmd=upload&amp;act=open&amp;pageid=60&amp;file=er.xml]]の内容をペースト
+ClientのLoad XMLをクリック
とすると、以下のような感じでER図が表示されるはずです。
#image(http://farm4.static.flickr.com/3025/2877903059_2f1c2fef57_o.jpg,width=700,title=gemspecのER図)

*そうそう
ここに描いたのは、最終イテレーションでの完成型なので、最初は色々な機能が実装されてない状態で公開する予定です。一部機能は気まぐれで無くなってしまうかも知れません。(てか今見てても整合取れてないところ有るし) 
ユーザ毎の画像ファイルは無くなるかもねー

*過去バージョンについて
たぶん、後でまたアップデートされるでしょうが、その都度最新版をアップするので、過程を知りたい方は上記手順で[[WWW SQL Designer&gt;&gt;http://ondras.zarovi.cz/sql/demo/]]使って見てください。
-[[最新&gt;http://www13.atwiki.jp/maimuzo?cmd=upload&amp;act=open&amp;pageid=60&amp;file=er.xml]]

*コメント
#pcomment(reply)    </description>
    <dc:date>2008-09-22T18:00:40+09:00</dc:date>
  </item>
  </rdf:RDF>

