当方法为索引时,设计显示nil的current_user

时间:2017-11-09 22:31:25

标签: ruby-on-rails devise

我检查了我的路线,我在路线中没有任何东西只说或者除了或者什么。如果我调用方法show it current_user就在那里。但是如果我将方法定义为索引。我无法获得当前用户。这是我想要显示当前用户信息的API文档。

int MemoryMapper::Write(const std::string& data)
{
    // include the null terminator if there is room...
    DWORD size = std::min(data.size() + 1, m_BufferSize);

    char *pBuffer = (char*) MapViewOfFile(m_OpenHandle, FILE_MAP_WRITE, 0, 0, size);
    if (!pBuffer)
    {
        DWORD errCode = GetLastError();
        std::cerr << m_DebugErrorTitle << "Write(): " << MM_ERROR_MAPPING_FAILED << " {" << errCode << "}" << std::endl;
        Close();
        return 0;
    }

    CopyMemory(pBuffer, data.c_str(), size);
    UnmapViewOfFile(pBuffer);

    m_WrittenSize += size;

    if (m_Debug > 1) {
        std::cout << m_DebugTitle << "Wrote " << size << " bytes." << std::endl;
    }

    return size;
}

int MemoryMapper::Read(std::string& data)
{
    char *pBuffer = (char*) MapViewOfFile(m_OpenHandle, FILE_MAP_READ, 0, 0, m_BufferSize);
    if (!pBuffer)
    {
        DWORD errCode = GetLastError();
        std::cerr << m_DebugErrorTitle << "Read(" << m_MemoryName << "): " << MM_ERROR_MAPPING_FAILED << " {" << errCode << "}" << std::endl;
        Close();
        return 0;
    }

    // check for a null terminator, but don't exceed the buffer...
    char *terminator = std::find(pBuffer, pBuffer + m_BufferSize, '\0');
    std::size_t len = std::distance(pBuffer, terminator);

    data.assign(pBuffer, len);
    UnmapViewOfFile(pBuffer);

    MessageBoxA(NULL, data.c_str(), "TEST MESSAGE", MB_OK);

    // include the null terminator if it was read...
    return std::min(len + 1, m_BufferSize);
}

1 个答案:

答案 0 :(得分:0)

我找到了。非常愚蠢。我把视图叫做show.html.erb。忘了重命名为索引。谢谢!