Forum: Ruby on Rails Using Rails and the Flickr API

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2cd7ec719ca4f264bd0e3e4173b7401d?d=identicon&s=25 Dan Croak (croaky)
on 2006-04-07 01:12
Hi all,

Week 2 of my Rails experience and I'm loving life!

This is one of my first times consuming a web service, but the Rails
demo made the process very exciting... I followed along with the video
and have my own little Flickr search up and running!  Woo hoo!

So now I want to do a bunch of other things to it and I'm struggling...
excuse my ignorance, but is there some extensive Ruby/Rails/Flickr
document somewhere?  I'd like to get some clues about how all the
different pieces fit together:

flickr.photos.search -
http://www.flickr.com/services/api/flickr.photos.search.html

flickr_controller.rb -

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

views/flickr/index.rhtml -

<%= form_remote_tag :url => {:action => 'search'}, :update => 'photos',
      :complete => visual_effect(:blind_down, 'photos'),
      :before   => %(Element.show('spinner')),
      :success  => %(Element.hide('spinner')) %>

  <%= image_tag '/images/spinner.gif', :id => 'spinner', :style =>
'display: none' %>

  <fieldset>
	<label for="tags">Tags:</label>
	<%= text_field_tag 'tags' %>
	<%= submit_tag 'Find' %>
  </fieldset>

  <div id="photos" style="display: none"></div>
<%= end_form_tag %>

views/flickr/_photo.rhtml -

<a href="<%= photo.sizes[0]['source'] %>"><img class="photo" src="<%=
photo.sizes[0]['source'] %>" /></a>
This topic is locked and can not be replied to.