Skip to content


WDMA members can upload pictures

Members can post pictures throughout the website.  Photos link to a harvest or just a note.  Members can include pictures in their profile also.

The Yahoo weather widget shows the local conditions and forecast.  Here is some of the code to make it work.  This is the Ruby components used to query Yahoo for the current local weather.  The first part, yweather.rb, goes in the Ruby on Rails web app folder ‘/lib’.  The part that manages the view goes in /app/views/layouts/

# /lib/yweather.rb
module Yweather

require 'rubygems'
require 'yahoo-weather'

def Yweather.get_weather
@client = YahooWeather::Client.new
@response = @client.lookup_location('19343')
return @response
end
end
<!-- /app/views/layouts/_weather.erb -->
&lt;% @yweather = Yweather::get_weather %&gt;
<div style="padding: 2px; font-family: arial; font-size: 7pt; background-color: #fff; color: #030; text-align: center;">&lt;%= @yweather.title %&gt;
<div><img src="%3C%=%20@yweather.image_url%20%%3E" alt="" />

&lt;%= @yweather.condition.temp %&gt; degrees &lt;%= @yweather.units.temperature %&gt;

&lt;%= @yweather.condition.text %&gt;
Forecast:

&lt;%= @yweather.forecasts[0].day %&gt; - &lt;%= @yweather.forecasts[0].text %&gt;.  High: &lt;%= @yweather.forecasts[0].high %&gt; Low: &lt;%= @yweather.forecasts[0].low %&gt;

&lt;%= @yweather.forecasts[1].day %&gt; - &lt;%= @yweather.forecasts[1].text %&gt;.  High: &lt;%= @yweather.forecasts[1].high %&gt; Low: &lt;%= @yweather.forecasts[1].low %&gt;

More information <a href="%3C%=%20@yweather.page_url%20%%3E">click here</a>.

</div>
</div>

Yahoo’s developer resources are great. And don’t forget to install the Ruby gem.

gem install yahoo-weather

Posted in Interests.

Tagged with , , .