2010-06-15 2 views
0

내 응용 프로그램에서 authlogic 및 openid를 얻으려고합니다. 지금까지 그것은 심각하게 불쾌했습니다. 주제에 대해 Railscasts를 따라하려고했지만 보석이나 플러그인 중 아무 것도 작동하지 않는 것 같습니다.# <accountSession : 자격증 명 없음>에 대한 'openid_identifier'정의되지 않은 메소드

previous error을 읽은 후 this open-id plugin (해당 페이지 하단에 언급 됨)을 설치했습니다. 이제 오류가 발생합니다.

ActionView::TemplateError (undefined method `openid_identifier' for #<AccountSession: no credentials provided>) on line #13 of app/views/account_sessions/new.html.haml: 

아직 개선되지 않았는지 확인할 수 없습니다.

뷰 :

%h3 
    Login: 
- form_for(@account_session) do |f| 
    = f.error_messages 
    %p 
    =t 'account.login' 
    =f.text_field :login 
    %p 
    =t 'account.password' 
    =f.password_field :password 
    %p 
    =t 'account.openid_identifier' 
    =f.text_field :openid_identifier 

컨트롤러 : 설치

class AccountSessionsController < ApplicationController 

     def new 
     @account_session = AccountSession.new 
     end 

     def create 
     @account_session = AccountSession.new(params[:account_session]) 

     @account_session.save do |result| 
     if result 
      flash[:notice] = I18n.t 'session.login_success' 
      redirect_to root_url 
     else 
      render :action => "new" 
     end 
     end 
     end 

     def destroy 
     @Account_session = AccountSession.find 
     @Account_session.destroy 
     flash[:notice] = I18n.t('session.logout_message') 
     redirect_to root_url 
     end 
    end  

보석 :

authlogic (2.1.5, 2.1.4, 2.1.3) 
authlogic-oid (1.0.4) 
ruby-openid (2.1.8, 2.1.7) 

그냥 나를 바보 같은 일을하고 있었다 듣는 좋은 소식이 될 것입니다. 그것의 늦은 및 나는 이것을 너무 오랫동안 그것의 확실히 가능하게 보았다.

감사합니다.

답변

0

플러그인에 대한 문서 (http://github.com/binarylogic/authlogic_openid)를 읽었습니까? 다음과 같은 이전을 작성/실행하는 것을 잊어 버린 것 같습니다.

class AddUsersOpenidField < ActiveRecord::Migration 
    def self.up 
     add_column :users, :openid_identifier, :string 
     add_index :users, :openid_identifier 

     change_column :users, :login, :string, :default => nil, :null => true 
     change_column :users, :crypted_password, :string, :default => nil, :null => true 
     change_column :users, :password_salt, :string, :default => nil, :null => true 
    end 

    def self.down 
     remove_column :users, :openid_identifier 

     [:login, :crypted_password, :password_salt].each do |field| 
     User.all(:conditions => "#{field} is NULL").each { |user| user.update_attribute(field, "") if user.send(field).nil? } 
     change_column :users, field, :string, :default => "", :null => false 
     end 
    end 
    end 
+0

다른 마이그레이션으로 모두 붙여 넣기가 끝납니다. 거기에 모두 거기에 ... – mikewilliamson

+0

잘 모르겠지만 그것은 @account_session에 openid_identifier를 호출하는 것 같지만 당신이 마이 그 레이션을 보면 openid_identifier는 사용자를위한 방법입니다. – sosborn