Twitter by John Nunemaker

Hi Railer's, Im pllaying around with the Twitter API wrapper by John Nunemaker, but i'm wondering where to put all the logic. It can't find any examples with this code built into rails.

What im doing now is like this, by the way Im pretty new to rails and ruby:

def index    @twitter_search = search_twitter_for('#twitter'); end

def show    @twitter_search = search_twitter_for('#twitter'); end

private

def search_twitter_for(query)    Twitter::Search.new(query) end

Is that the right way to use it?

What if I want to use the OAuth, where do I put the following?

oauth = Twitter::OAuth.new('consumer token', 'consumer secret') oauth.authorize_from_access('access token', 'access secret')

client = Twitter::Base.new(oauth)

Should i live in a model of it's own or?

Hi Marnen, Thank you for the answer, colud you please explain this a little bit more: "It may be the right way to use the Twitter gem, but it's the wrong way to use Rails."

andkjaer wrote:

Hi Marnen, Thank you for the answer, colud you please explain this a little bit more: "It may be the right way to use the Twitter gem, but it's the wrong way to use Rails."

I mean that -- as detailed in my earlier post -- you're not really putting things in the best places for the MVC nature of the framework.

On 1 Nov., 18:56, Marnen Laibow-Koser <rails-mailing-l...@andreas-

Best,

I know, that's why I ask where to put the different things. What I don't understand right now is you write "It may be the right way to use the Twitter gem, but it's the wrong way to use Rails." How should i then use the GEM the Rails way (Right way)?

Thanks... :O)

andkjaer wrote:

I know, that's why I ask where to put the different things. What I don't understand right now is you write "It may be the right way to use the Twitter gem, but it's the wrong way to use Rails." How should i then use the GEM the Rails way (Right way)?

I already made specific suggestions about moving stuff into the model. Pleasef follow them.

Thanks... :O)

On 2 Nov., 01:47, Marnen Laibow-Koser <rails-mailing-l...@andreas-

Best,