Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 向adauth添加电子邮件会导致';未定义的方法';邮寄'';错误_Ruby On Rails - Fatal编程技术网

Ruby on rails 向adauth添加电子邮件会导致';未定义的方法';邮寄'';错误

Ruby on rails 向adauth添加电子邮件会导致';未定义的方法';邮寄'';错误,ruby-on-rails,Ruby On Rails,使用adauth时,我需要能够从active directory获取电子邮件 Rails 4.x、ruby 2.0 如果我在user.rb中添加电子邮件映射,我会得到一个错误 SessionController中的NoMethodError#为创建未定义的方法“mail” root:C:/Users/cmendla/RubymineProjects/technical\u库 应用程序跟踪|框架跟踪|完整跟踪 app/controllers/sessions\u controller.rb:17:

使用adauth时,我需要能够从active directory获取电子邮件

Rails 4.x、ruby 2.0

如果我在user.rb中添加电子邮件映射,我会得到一个错误

SessionController中的NoMethodError#为创建未定义的方法“mail”

root:C:/Users/cmendla/RubymineProjects/technical\u库

应用程序跟踪|框架跟踪|完整跟踪 app/controllers/sessions\u controller.rb:17:in'create'

会话\u controller.rb-创建:

def create
        ldap_user = Adauth.authenticate(params[:username], params[:password])
        #           byebug

        if ldap_user

            user = User.return_and_create_from_adauth(ldap_user)
            session[:user_id] = user.id
            redirect_to home_path, :notice => "You are now logged in "
            # byebug
        else
            redirect_to '/signin', :notice => "Invalid Login"
        end
    end
用户架构:

create_table "users", force: :cascade do |t|
    t.string   "login"
    t.text     "group_strings"
    t.string   "name"
    t.string   "ou_strings"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
    t.string   "email"
  end

如果我将电子邮件映射出来,adauth工作正常

当用户对象没有邮件时,这种情况也会发生在我身上。当用户对象没有邮件时,这种情况也会发生在我身上
def create
        ldap_user = Adauth.authenticate(params[:username], params[:password])
        #           byebug

        if ldap_user

            user = User.return_and_create_from_adauth(ldap_user)
            session[:user_id] = user.id
            redirect_to home_path, :notice => "You are now logged in "
            # byebug
        else
            redirect_to '/signin', :notice => "Invalid Login"
        end
    end
create_table "users", force: :cascade do |t|
    t.string   "login"
    t.text     "group_strings"
    t.string   "name"
    t.string   "ou_strings"
    t.datetime "created_at",    null: false
    t.datetime "updated_at",    null: false
    t.string   "email"
  end