blog.sowatchasayin

Rails etc.

Showing posts with label restful_authentication. Show all posts
Showing posts with label restful_authentication. Show all posts

最新のRailsでrestful_authenticationを使う苦労に苛まれる初秋の一日でした。

2.3.4でrestful_authenticationのspecが通らない。この子たちのせいだった。

Rspecが新しいとダメな所がありました。下記のパッチみたいに直せばOKでした(update for rspec > 1.1.12らしい)。
http://github.com/dchelimsky/restful-authentication/commit/ad92c6cb52500c37ef81e30ac4e79adffc2f4d39

formatted_* routesが無くなった。これで通るっす。
- formatted_user_path(:id => '1', :format => 'xml').should == "/users/1.xml"
- formatted_user_path(:id => '1', :format => 'json').should == "/users/1.json"
+ user_path(:id => '1', :format => 'xml').should == "/users/1.xml"
+ user_path(:id => '1', :format => 'json').should == "/users/1.json"

いきさつ
What's New in Edge Rails: No More Formatted Routes
Add optional :format argument to named routes

site_keyをリポジトリに置いてないが故の。

Restful_AuthenticationのREADMEに「site_keys.rbはリポジトリに置くな」とある。確かに。
で、チェックアウトしたアプリケーションはsite_keyが無いので動かない。

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant REST_AUTH_SITE_KEY (NameError)

って怒られる。

やっぱり。site_keys.rbはrakeで作れました!
Uninitialized Constant By Password

$ rake auth:gen:site_key

Author

Fujimura Daisuke
http://fujimuradaisuke.com

Labels