I''m trying to get my del.icio.us links to appear in the layout, so
it''s
throughout the entire application. Here''s the code I have:
#controller - application.rb?
def get_authenticated(path, http)
request = Net::HTTP::Get.new(path)
request.basic_auth ''user'', ''pass''
response = http.request(request)
response.value
response.body
end
@links = Array.new
@descriptions = Array.new
@times = Array.new
@i = 0
http = Net::HTTP.new(''api.del.icio.us'', 443)
http.use_ssl = true
http.start do |http|
xml =
get_authenticated(''/v1/posts/recent?count=10&tag=rpheath'',
http)
REXML::Document.new(xml).root.get_elements(''post'').each do
|post|
link = post.attributes[''href'']
@links << link
desc = post.attributes[''description'']
@descriptions << desc
time = post.attributes[''time'']
@times << time
end
end
#layout - application.rhtml?
<% for link in @links %>
<!-- display the links and stuff -->
<% end %>
All of this code works fine - I just don''t know where to put it so that
it will show up in a layout that I can use across my application. Any
help on this???
Thanks!
--
Posted via http://www.ruby-forum.com/.