restful_authentication

fugafugaにrestful_authenticationをセットアップ。(6) ~ app/models/user_mailer.rbの修正

※「APP_CONFIG~」は、config/config.ymlで定数として定義しています。 # app/models/user_mailer.rb def signup_notification(user) setup_email(user) @subject += 'Please activate your new account' - @body[:url] = "http://YOURSITE/activate/#{user.a…

fugafugaにrestful_authenticationをセットアップ。(5) ~ Userモデルの初期値の設定

※「APP_CONFIG~」は、config/config.ymlで定数として定義しています。とりあえず、定数は、config/config.yml作って、config/environment.rbで、restful_authentication_tutorialを参考に。 require File.join(File.dirname(__FILE__), 'boot') + #Load appl…

fugafugaにrestful_authenticationをセットアップ。(4) ~ spec/helpers/users_helper_spec.rbの修正

イヤ、これが結構、悩みましたわ。 # spec/helpers/users_helper_spec.rb (略) it "should use the login as link text with no :content_method specified" do - link_to_user(@user).should have_tag("a", 'user_name') + link_to_user(@user).should have…

fugafugaにrestful_authenticationをセットアップ。(3) ~ spec/controllers/*_spec.rbの修正

んじゃあ、コントローラのspecの修正。 結構、悩んだねぇwww # lib/authenticated_test_helper.rb (略) def authorize_as(user) - @request.env["HTTP_AUTHORIZATION"] = user ? ActionController::HttpAuthentication::Basic.encode_credentials(users(user…

fugafugaにrestful_authenticationをセットアップ。(2) ~ spec/models/user_spec.rbの修正

とりあえず、RSpecのセットアップ。 $ script/generate rspec んじゃあ、とりあえず、テスト。 $ rake spec:models (略) #=> 75 examples, 75 failures #=> rake aborted! (略)...そりゃそうだ。 認証をloginからemailに変更しているからねぇ。 修正、マンド…

fugafugaにrestful_authenticationをセットアップ。(1)

月並みに。 $ script/generate authenticated user sessions --aasm --rspecAASMとRSpecに対応させて頂きました。 んで、config/routes.rbに追記。 map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate', :activation…

fugafugaにpluginをインスコする。

今回使う予定のpluginは、 Restful Authentication Generator Role Requirement acts_as_taggable_on_steroids この辺で。 後は、後から考えよう;-p で、インスコ。 $ git clone git://github.com/technoweenie/restful-authentication.git vendor/plugins/r…

restful_authenticationの生成したフィクスチャ、users.ymlを動的なものにする。

いやはや。 友達機能だとか、メッセージ機能だとかのテストをするとなると、やっぱり、沢山のユーザ・データが必要になる訳ですわ。 でも、restful_authenticationのジェネレータでは、たった3件、role_requiremetで作られるadminユーザを入れても、たったの…

登録済みユーザの初期データを入れる。

なんか、面倒臭くなってきたw 相変わらず、テストは上手く動かないしwww まあ、たぶん、fixtureのcrypted_passwordとかsaltとかの絡みだとは思うんだが。まんどくせっんじゃあ、登録済みユーザの初期データのマイグレーション。 $ script/generate migration…

それじゃあ、Rolesコントローラでも作ろうか。

まあ、見出しの通りなんだけどwwwで、コントローラの生成。 今回は、 index => roleの一覧 show => roleの詳細 edit => roleの編集 new =>roleの新規作成 create => roleの登録 update => roleの更新 destroy => roleの削除 ってな感じなんだが。 viewが必要…

roleの管理機能を作ろうと思ったけど、

眠いから止めたwww つうか、ね? 寝ぼけてる頭で、DBのリレーションとか、理解できないっすよwwwなんすか、habtmってwwwんで、でも、やらなきゃいけないことは、やらなきゃいけないんで、とりあえず、Userのアクション作っといた。app/controllers/users_cont…

名を名乗れ。

とりあえず、ユーザmodelの中に、本名の項目を作ろう。 family_nameとmiddle_nameとgiven_nameね。 外人も使うかも知れないからねwww $ script/generate migration AddColumnFamilyNameAndMiddleNameAndGivenNameToUser family_name:string middle_name:stri…

とりあえず、メールアドレスで認証するようにする。

今どき、ハンドル・ネームでのログインってのも、ねえ? なんてことを、bloggerにも書いてたな...まあ、ヨシとするwwwで、Userモデルから、loginとnameを消して、nicknameを追加することにする。 で、マイグレーションファイルの作成。 まず、loginとnameの削…