Hi im working with the Twitter gem, suddenly i get this error:
Twitter is not a module
/Users/KAN/.gem/ruby/1.8/gems/twitter-0.7.0/lib/twitter/search.rb:1
vendor/rails/activesupport/lib/active_support/dependencies.rb:368:in
load_without_new_constant_marking' vendor/rails/activesupport/lib/active_support/dependencies.rb:368:in
load_file’
vendor/rails/activesupport/lib/active_support/dependencies.rb:507:in
new_constants_in' vendor/rails/activesupport/lib/active_support/dependencies.rb:367:in
load_file’
vendor/rails/activesupport/lib/active_support/dependencies.rb:248:in
require_or_load' vendor/rails/activesupport/lib/active_support/dependencies.rb:413:in
load_missing_constant’
vendor/rails/activesupport/lib/active_support/dependencies.rb:93:in
const_missing' app/controllers/application.rb:49:in
twitter_search’
What the problem? What does the error mean?
Thamks… :O)
On Tue, Nov 3, 2009 at 1:50 PM, andkjaer [email protected] wrote:
load_without_new_constant_marking' vendor/rails/activesupport/lib/active_support/dependencies.rb:93:in
const_missing’
app/controllers/application.rb:49:in `twitter_search’
What the problem? What does the error mean?
The problem is you’re trying to use Twitter as a module and it is not a
module?
Please post the code where you’re getting the error so we can help
you, otherwise is pretty impossible.
Cheers.
–
Leonardo M…
There’s no place like ~
I try to use it like this:
def twitter_search
@twitter_search = Twitter::Search.new(’#rails’)
end
On Tue, Nov 3, 2009 at 2:31 PM, andkjaer [email protected] wrote:
I try to use it like this:
def twitter_search
@twitter_search = Twitter::Search.new(‘#rails’)
end
OK, I haven’t used the Twitter gem, so I don’t know the right syntax,
but you’re certainly using it as a module.
Are you sure that’s the right way to use it?
If it is, have you required the file where Twitter is defined?
–
Leonardo M…
There’s no place like ~
I don’t know if im using it the right way, i can’t find any examples.
The DOC for the GEM is here: http://twitter.rubyforge.org/
And the GEM at github: GitHub - jnunemaker/twitter: The twitter gem has moved to https://github.com/sferik/twitter
I know and have looked at it, but i still can’t see how to use it!
The example shows the oAuth feature - but I just want to use the
search functions.
On Tue, Nov 3, 2009 at 4:09 PM, andkjaer [email protected] wrote:
I don’t know if im using it the right way, i can’t find any examples.
The DOC for the GEM is here: http://twitter.rubyforge.org/
There are examples listed on the page you listed above. There’s even a
link to a sample rails application on github, there.
Twitter seems to be a module, you should require the file somewhere.
Take a look at the sample application and see where it is required.
–
Leonardo M…
There’s no place like ~
On Nov 3, 12:50 pm, andkjaer [email protected] wrote:
Hi im working with the Twitter gem, suddenly i get this error:
Twitter is not a module
One vague stab in the dark: do you define a class of your own called
Twitter ?
Fred
Dosen’t anybody know how to use the GEM?
Thanks…
On Nov 4, 7:05 am, andkjaer [email protected] wrote:
Dosen’t anybody know how to use the GEM?
what about the 4 examples on the gem’s website (which you linked to
earlier) ?
Fred
Is i did :O( BIG MISTAKE!
But still what is the right way to use a gem like this?
Is it really the right way to call the search method?
def twitter_search
@twitter_search = Twitter::Search.new(’#rails’)
end
On Wed, Nov 4, 2009 at 10:57 AM, andkjaer [email protected]
wrote:
in my other controllers, where i want to use the method?
Please let me know if you know how to use it…
That’s not how to use the gem. That’s your application’s design.
The use of the gem API is just like the examples show. Where you use
it depends on your application design and there’s no one valid rule
about that.
My guess is you will be using it mostly on controllers, but it’s
totally up to you!
–
Leonardo M…
There’s no place like ~
Hi Fred,
I know it’s there but i dont now how to use it!
Should I put it in a model method and use it like this:
def twitter_search
@twitter_search = Twitter::Search.new(’#rails’)
end
Should I put it in the Application controller and call a before filter
in my other controllers, where i want to use the method?
Please let me know if you know how to use it…