chaitanyabm / gdata-ruby-util

Automatically exported from code.google.com/p/gdata-ruby-util
Apache License 2.0
0 stars 0 forks source link

uninitialized constant Cal::GData #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. installed the gdata gem
2. tried out the example code in controller ("cal")
3. throws the following error:

NameError in CalController#index

uninitialized constant Cal::GData

/Users/fabrik42/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/depend
encies.rb:105:in
`const_missing'
/Users/fabrik42/Dev/Rails/testGdata/app/models/cal.rb:5:in `fetch_gdata'
/Users/fabrik42/Dev/Rails/testGdata/app/controllers/cal_controller.rb:5:in
`index'

using RoR 2.3.2 with Ruby 1.8.6 p114 on OS X Leopard

Original issue reported on code.google.com by fabri...@gmail.com on 14 Apr 2009 at 2:49

GoogleCodeExporter commented 8 years ago
What the heck is Cal::GData? There is nothing in the gem named that.

Also what example code are you referencing?

Original comment by jfis...@youtube.com on 14 Apr 2009 at 5:53

GoogleCodeExporter commented 8 years ago
Cal is the name of my Controller class.

I used the "Example readonly request to YouTube" within Cal

def index
  yt = GData::Client::YouTube.new
  feed = yt.get('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated')
end

Is there anything to require/include you haven't mentioned?

Original comment by fabri...@gmail.com on 14 Apr 2009 at 6:21

GoogleCodeExporter commented 8 years ago
I'm curious about this line of the trace:

/Users/fabrik42/Dev/Rails/testGdata/app/models/cal.rb:5:in `fetch_gdata'

How is a model being involved here? What's at line 5 of it? Where is the 
cosntant
"Cal::GData" being referenced?

Original comment by jfis...@youtube.com on 14 Apr 2009 at 6:31

GoogleCodeExporter commented 8 years ago
oh sorry my fault. this was the first try, where I put the example in a method 
of a
model (same method like above, but named fetch_gdata). Line 5 is:

yt = GData::Client::YouTube.new

I'm pretty new to Ruby on Rails, but it seems like Rails is thinking GData has 
to be
a subclass of my Controller or Model?!

Original comment by fabri...@gmail.com on 14 Apr 2009 at 6:36

GoogleCodeExporter commented 8 years ago
Hmm are you requiring the gem somewhere? :)

Original comment by jfis...@youtube.com on 14 Apr 2009 at 6:38

GoogleCodeExporter commented 8 years ago
Hum... I got it! XD
I looked through the source code of your demo app and I forgot to add the line

config.gem 'gdata', :lib => 'gdata'

to my config/enviroment.rb file.

Maybe you want to mention this somewhere, for other rails newbies like me.

Sorry for wasting your time, but thanks a lot for your patience!

Original comment by fabri...@gmail.com on 14 Apr 2009 at 6:46

GoogleCodeExporter commented 8 years ago
No worries, glad you figured it out. I'm actually sort of a Rails n00b myself, 
not
having designed the client for rails in particular but rather to be used in any 
Ruby
environment. :)

Perhaps a future goal is to have a zipped up example Rails project that demos 
the use
of the API with a README documenting the important bits.

Original comment by jfis...@youtube.com on 14 Apr 2009 at 6:51

GoogleCodeExporter commented 8 years ago
Well, I think the article at
http://code.google.com/intl/de-DE/apis/gdata/articles/gdata_on_rails.html is a 
very
good explanation.

Maybe it's just to well written and I switched my brain off to early. ;)

Original comment by fabri...@gmail.com on 14 Apr 2009 at 7:11