RAILS PRESS RUBY on RAILS, it’s DRY and COOL …

RSS Feed

RAILS PRESS RSS

Tag Cloud

はてなブックマーク - railspress.matake.jp の注目エントリー
象形文字くさび形文字ミイラそろばんの玉そろばんコーラン占いの板?象牙大英博物館
« 前の3件
Tagged by Rails2.0

Posted on
2008/05/01

Tags
ActionMailer, Rails2.0, インストール/設定

0 Comment

この記事をはてなブックマークに登録 この記事のはてなブックマーク数 この記事を livedoor クリップに登録この記事の livedoor クリップ数 このエントリを del.icio.us に追加
ブックマークに追加する

Rails2.0ではActionMailer::Base.server_settingsは使えない

いままでActionMailerでSMTP/SendMailを使う場合は、「ヽ( ・∀・)ノくまくまー」さんのActionMailer::Base.server_settingsの書き方を参考にしていたのですが、Rails2.0になってからはserver_settingsというメソッドが廃止されたようです。

代わりに以下のように、smtp_settings or sendmail_settingsを使います。

例)SMTP Settings

LANG : RUBY
  1. ActionMailer::Base.delivery_method = :smtp
  2. ActionMailer::Base.smtp_settings = {
  3.         :address                => "smtp.mymailserver.com",
  4.         :authentication        => :login,
  5.         :user_name                => "me",
  6.         :password                => "password"
  7. }

例)SendMail Settings

LANG : RUBY
  1. ActionMailer::Base.delivery_method = :sendmail
  2. ActionMailer::Base.sendmail_settings = {
  3.   :location       => '/usr/sbin/sendmail',
  4.   :arguments      => '-i -t'
  5. }

» このエントリーには続きがあります。続きを読む »


Posted on
2008/02/08

Tags
Gem, OpenID, Plugin, Rails2.0, トラップ, バグ

3 Comments

この記事をはてなブックマークに登録 この記事のはてなブックマーク数 この記事を livedoor クリップに登録この記事の livedoor クリップ数 このエントリを del.icio.us に追加
ブックマークに追加する

OpenId Authentication Pluginのサンプルにはまった。

最近RailsのOpenIdAuthentication Pluginに挑戦しています。

open_id_authenticationプラグインの導入はこちらを参考にしました。

open_id_authentication*[認証][Rails] open_id_authenticationをつかってみる - KazusaAPI開発日誌 - KDRIグループ

koress.jp: 解消法: open_id_authenticationプラグイン(rails 2.0.2)

サンプルを動かしてみてOpenID Profider(IdP)からリダイレクトされてくるところまではスムーズに行ったのですが、その後のレスポンスを解析する部分で、このプラグインに添付してあるサンプルソースに潜んだバグ(?)にはまりました。

具体的にハマったのは、サンプルソース内の以下の部分で使われているcase .. when構文の比較ルール。

LANG : RUBY
  1. authenticate_with_open_id do |result, identity_url|
  2.   case result
  3.   when :missing
  4.     failed_login "Sorry, the OpenID server couldn't be found"
  5.   when :canceled
  6.     failed_login "OpenID verification was canceled"
  7.   when :failed
  8.     failed_login "Sorry, the OpenID verification failed"
  9.   when :successful
  10.     if @current_user = @account.users.find_by_identity_url(identity_url)
  11.       successful_login
  12.     else
  13.       failed_login "Sorry, no user by that identity URL exists (#{identity_url})"
  14.     end
  15.   end
  16. end

ここでは以下のような評価を想定されているようです。

» このエントリーには続きがあります。続きを読む »


Posted on
2007/12/29

Tags
ActionController, Rails2.0, Routes, まとめ

4 Comments

この記事をはてなブックマークに登録 この記事のはてなブックマーク数 この記事を livedoor クリップに登録この記事の livedoor クリップ数 このエントリを del.icio.us に追加
ブックマークに追加する

Rails2.0のRouting(config/routes.rb)の記述方式についてのまとめ。

なんだかRails2.0になってから、routes.rbの書き方を毎回Googleさんに聞いている気がしたので、ちょっとまとめておきます。
(この他にも、routesの記述方式についての有用な情報があれば、コメントいただければうれしいです!!)

まず、Rails2.0のroutes.rbでは、以下の6種類のRoutingの書き方があります。

LANG : RUBY
  1. map.connect
  2. map.purchase(任意のパス名)
  3. map.with_options
  4. map.root
  5. map.resource
  6. map.resources
  7. map.namespace

map.connectとmap.purchase

「map.connect」と「map.purchase」はrails1.x系からおなじみですね。

「map.connect」と「map.purchase(任意のパス名)」については、2005年の情報ですが「Routes :: 優しいRailsの育て方 :: ヽ( ・∀・)ノくまくまー)」によくまとめられています。くまくまさんにはいつもおせわになってます。

またパラメータにURLを直接渡したい場合は、「routes.rbでURLを丸ごとパラメータとして渡す記述法 - Hello, world! - s21g」が参考になります。

» このエントリーには続きがあります。続きを読む »


« 前の3件
Rails2.0タグ