SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Addict
    Join Date
    Apr 2003
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    (new to rails) Error on flickr app

    Hi

    I'm new to rails and am just trying out some tutorials before I delve
    into it properly.

    I'm trying to create the flickr app (found in the screencasts section on
    rubyonrails.com)

    I've built everything according to the video and all the code is correct
    however I'm getting the following error.

    Code:
    NameError in FlickrController#search
    
    uninitialized constant Flickr
    
    RAILS_ROOT: ./script/../config/..
    Application Trace | Framework Trace | Full Trace
    
    d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:123:in 
    `const_missing'
    d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:131:in 
    `const_missing'
    d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in 
    `send'
    d:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:133:in 
    `const_missing'
    #{RAILS_ROOT}/app/controllers/flickr_controller.rb:3:in `search'
    
    This error occured while loading the following files:
       flickr.rb
    No idea what's causing it. Any help?

  2. #2
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post your flickr.rb model?

  3. #3
    SitePoint Addict
    Join Date
    Apr 2003
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Luke Redpath
    Can you post your flickr.rb model?
    It's here.. http://pastebin.com/701969

    Installed by using gem install -r flickr

    My flickr controller is
    Code:
    class FlickrController < ApplicationController
      def search
        flickr = Flickr.new '626ed109d2705948c31ca81e5e22051c'
        render :partial => "photo", :collection =>
          flickr.photos(:tags => params[:tags], :per_page => '24')
      end
    end

    Also my error out has changed, even though I haven't changed anything it's now..

    Code:
    d:/ruby/lib/ruby/gems/1.8/gems/flickr-1.0.0/flickr.rb:67:in `request'
    d:/ruby/lib/ruby/gems/1.8/gems/flickr-1.0.0/flickr.rb:142:in `method_missing'
    d:/ruby/lib/ruby/gems/1.8/gems/flickr-1.0.0/flickr.rb:102:in `photos'
    #{RAILS_ROOT}/app/controllers/flickr_controller.rb:5:in `search'
    I'm wondering if that screencast tutorial is outdated?

  4. #4
    SitePoint Addict
    Join Date
    Apr 2003
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anybody?

  5. #5
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is flickr.rb in app/models/ ?

    Can you post the entire error page? It seems that you only posted the backtrace now, not the actual errormessage.

  6. #6
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I remember correctly, he downloads the Flickr Gem at the beginning of the tutorial. Did you do that? I'm not sure what its called but probably 'flickr' so:
    Code:
      gem install flickr
    Happy switcher to OS X running on a MacBook Pro.

    Zend Certified Engineer

  7. #7
    SitePoint Enthusiast
    Join Date
    Oct 2006
    Location
    San Francisco, CA
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey chris,

    are you actually still getting the NameError in FlickrController#search error, or is it something else now.

    the error code you last posted was not complete, and looks like it was something else.

    adrian

  8. #8
    Awesome Addict
    Join Date
    Mar 2004
    Location
    Toronto, Canada
    Posts
    326
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chris Gwynne View Post
    Code:
    d:/ruby/lib/ruby/gems/1.8/gems/flickr-1.0.0/flickr.rb:67:in `request'
    d:/ruby/lib/ruby/gems/1.8/gems/flickr-1.0.0/flickr.rb:142:in `method_missing'
    d:/ruby/lib/ruby/gems/1.8/gems/flickr-1.0.0/flickr.rb:102:in `photos'
    #{RAILS_ROOT}/app/controllers/flickr_controller.rb:5:in `search'
    This error stems from the fact that the api key in the Flickr class constructor is invalid (it's a known bug -- see here for more: http://wonko.com/article/452). Browse to flickr.rb and edit the initialize method by replacing the api key that is there with your own. If it fails restart your server and try again.
    Last edited by gregor002; Jan 13, 2007 at 23:47.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •