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>
--
Posted via http://www.ruby-forum.com/.