Skip to content

Can't call User#twitter from User class #23

@marnen

Description

@marnen

I'm having a strange problem. If I call current_user.twitter.get('statuses/friends_timeline') from a controller, it works as expected. However, if I do this:

controller

current_user.timeline

User

def timeline
  twitter.get('statuses/friends_timeline')
end

...I get a NoMethodError: can't call downcase on NilClass. After a bit of debugging, it seems that when the OAuth module generates a signature, for some reason, it's not setting the hostname properly (so it's still nil, so it doesn't respond to downcase), with the result that request-uri is something like http::80/statuses/friends_timeline.

But it's baffling to me that it works in one case and not in the other, because I don't see any functional difference in how the methods are being called in the two cases. This is particularly frustrating since I'm trying to put logic in the model, not the controller, and TwitterAuth is preventing me from doing so.

Please help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions