All pastes #133974 Raw Edit

Someone

public text v1 · immutable
#133974 ·published 2006-08-16 05:53 UTC
rendered paste body
I am attempting to access a hash returned from a table using ActiveRecord:

-----
@zipcode = Zipcode.find(:all, :conditions => ["zipcode = ?", collected_digits])

if caller_district.empty?
speak_text("You do not have a valid zipcode with a district entry, goodbye.")
hang_up()
exit(0)
end

speak_text('step two')
caller_district = @zipcode.city
-----

I successfully get to 'step two' (I am using RAGI for Asterisk integration here) but when I attempt to load the city field (it does exist and has a value of "New York") I get the following error in the console:

-----
[2006-08-15 17:20:33] ERROR NoMethodError: undefined method `city' for [#<Zipcode:0xb74ecdf0 @attributes={"city"=>"New York"}>]:Array
./script/../config/../app/handlers/agi_handler.rb:39:in `IPTA_AGI'
-----

I know this must be an easy one, but it is escaping me. Ideas?