2011-05-25 49 views
3

我一直是这样,现在挣扎的日子里,希望有人能帮助:)LinkedIn宝石无法查看档案

已经连接到LinkedIn与LinkedIn宝石和oauth_plugin。一切看起来都很好,但我无法从中得到任何信息。 Twitter,脸书等都工作得很好。

安装后,我遇到了一些问题,“nil:NilClass”的undefined method'downcase',通过向oauth选项添加站点参数解决了这个问题。

现在它几乎像它甚至没有连接...

我的模型如下:

require 'linkedin' 
class LinkedinToken < ConsumerToken 
    def client 
    client = LinkedIn::Client.new(LinkedinToken.consumer.key, LinkedinToken.consumer.secret) 
    client.authorize_from_access(token, secret) 
    @client = client.profile 
    end 
end 

显示:

Linkedin: <% @user.linkedin_token.client %> 

我从字面上得不到任何输出!我究竟做错了什么?

- 更新 -

如果我改变模式:

require 'linkedin' 
class LinkedinToken < ConsumerToken 
    def client 
    oauth = LinkedIn::Client.new(LinkedinToken.consumer.key, LinkedinToken.consumer.secret) 
    oauth.authorize_from_access(token, secret) 
    end 
end 

并显示到:

<%= @user.linkedin_token.client %> 

我结束了这一点:

["92af0f43-380d-45ef-90bb-a0a509c1baf0", "26c92c3f-1e84-458b-adc6-7b712a215222"] 

哪个不对...

回答

1

我不知道LinkedIn的宝石什么,但...在你的控制器使用@client并在您的视图您使用@user