Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marnen opened this issue Dec 29, 2009 · 5 comments
Open

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

marnen opened this issue Dec 29, 2009 · 5 comments

Comments

@marnen
Copy link

marnen commented Dec 29, 2009

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.

@marnen
Copy link
Author

marnen commented Dec 29, 2009

BTW, post is no problem when called from User. Go figure.

@marnen
Copy link
Author

marnen commented Dec 29, 2009

No, I spoke too soon. Post has the same problem.

@marnen
Copy link
Author

marnen commented Dec 30, 2009

This is apparently not a TwitterAuth issue. I'll be darned if I can figure out what's causing it, because I have two apparently identical commits, of which one always causes the error and the other never does, but TwitterAuth is off the hook.

@marnen
Copy link
Author

marnen commented Dec 30, 2009

Trying to close issue.

@marnen
Copy link
Author

marnen commented Dec 30, 2009

Grrr. Comment and Close is not working. Would someone put this ticket out of its misery? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant