comparison of Array with Array failed



I am passing this hash to a method to sort it, which works in irb but in
rails I can't get past it

report = {
:cals => @total_cals,
:fat => @dv_fat,
:sfat => @dv_sfat,
:carbs => @dv_carbs,
:chol => @dv_chol,
:sodium => @dv_sodium,
:protein => @dv_protein,
:fiber => @dv_fiber,
:calcium => @dv_calcium,
:copper => @dv_copper,
:folid_acid => @dv_folid_acid,
:iron => @dv_iron,
:magnesium => @dv_magnesium,
:iron => @dv_iron,
:pantothenic_acid => @dv_pantothenic_acid,
:phosphorus => @dv_phosphorus,
:riboflavin => @dv_riboflavin,
:thiamin => @dv_thiamin,
:a_iu => @dv_a_iu,
:b6 => @dv_b6,
:b12 => @dv_b12,
:c => @dv_c,
:d => @dv_d,
:e => @dv_e,
:zinc => @dv_zinc,
:potassium => @dv_potassium }


Here is the method giving me trouble

def overview_text(report_hash)

array_sorted = report_hash.sort { |a,b| a[1] <=> b[1] }.reverse

rich = very_plentiful = plentiful = good_source =
small_amount = minimal_amount = Array.new

@a = 0
until @a == array_sorted.length
if array_sorted[@a].last > 35 && (array_sorted[@a][0] == :fat or
array_sorted[@a][0] == :carbs or array_sorted[@a][0] == :protein or
array_sorted[@a][0] == :fiber or array_sorted[@a][0] == :chol)
rich << array_sorted[@a].first.to_s
elsif array_sorted[@a].last > 35 && (array_sorted[@a][0] != :fat
or array_sorted[@a][0] != :carbs or array_sorted[@a][0] != :protein or
array_sorted[@a][0] != :fiber or array_sorted[@a][0] != :chol)
very_plentiful << array_sorted[@a].first.to_s
elsif array_sorted[@a].last <= 35 && array_sorted[@a].last > 20
plentiful << array_sorted[@a].first.to_s
elsif array_sorted[@a].last <= 20 && array_sorted[@a].last > 8
good_source << array_sorted[@a].first.to_s
elsif array_sorted[@a].last <= 8 && array_sorted[@a].last > 2
small_amount << array_sorted[@a].first.to_s
elsif array_sorted[@a].last <= 2 && array_sorted[@a].last > 0
minimal_amount << array_sorted[@a].first.to_s
end
@a += 1
end
output = "Rich in #{rich.to_sentence}, ",
"Very Plentiful in #{very_plentiful.to_sentence}, ",
"Plentiful of #{plentiful.to_sentence}, ",
"a Good Source of #{good_source.to_sentence}, ",
"with Small Amounts of #{small_amount.to_sentence}, ",
"and Very Low in #{minimal_amount.to_sentence}."
.



Relevant Pages

  • Re: Report in FM 6 or 7
    ... Please adivse on this- and then, I get to attack this report again in ... you cannot sort by AgeDivision_Category and why the Export/Import ... act they want to be the last act of the show, they have to sort by their ... If the Age Division field contains data in the form "3-5 Age Division" ...
    (comp.databases.filemaker)
  • Re: Report in FM 6 or 7
    ... Please adivse on this- and then, I get to attack this report again in ... you cannot sort by AgeDivision_Category and why the Export/Import ... act they want to be the last act of the show, they have to sort by their ... If the Age Division field contains data in the form "3-5 Age Division" ...
    (comp.databases.filemaker)
  • Re: sort in report
    ... "fredg" wrote: ... date on my report. ... fields I would like to sort on in a report: ... so the format is irrelevant). ...
    (microsoft.public.access.gettingstarted)
  • Re: Report in FM 6 or 7
    ... Please adivse on this- and then, I get to attack this report again in ... you cannot sort by AgeDivision_Category and why the Export/Import ... act they want to be the last act of the show, they have to sort by their ... If the Age Division field contains data in the form "3-5 Age Division" ...
    (comp.databases.filemaker)
  • Re: Sorting Dates
    ... dates to sort properly. ... and grouping expressions used in your report design view. ... Select the overtime hours totals field and Descinding order That is if you ... Then below that select the 'seniority ...
    (microsoft.public.access.reports)