[Rails] Re: for - next loop

2009-07-29 Thread pepe
I'd bet I'm not the only one waiting to see your beautiful code. ;p Pepe On Jul 29, 4:18 am, Rakoth wrote: > difficult to provide anything more ugly > > > for tax in @taxes > >   next if ! (tax.taxauthid === [ 24, 25, 26, 27, 36, 37, 38, 39]) > >   print tax.taxamount + " - " + tax.taxauthid +

[Rails] Re: for - next loop

2009-07-29 Thread Craig White
On Wed, 2009-07-29 at 19:30 +0200, Marnen Laibow-Koser wrote: > Craig White wrote: > [...] > > yes, thanks...the .include? worked > > Great. > > > where the comparison operator === did > > not work for me (or at least I gave up trying) > > Why do you say it still didn't work? I explained in m

[Rails] Re: for - next loop

2009-07-29 Thread Marnen Laibow-Koser
Craig White wrote: [...] > yes, thanks...the .include? worked Great. > where the comparison operator === did > not work for me (or at least I gave up trying) Why do you say it still didn't work? I explained in my previous message *exactly* how to get === to work. Please read text, not just

[Rails] Re: for - next loop

2009-07-29 Thread Craig White
On Wed, 2009-07-29 at 17:14 +0200, Marnen Laibow-Koser wrote: > Craig White wrote: > > Even my pickaxe book suggests this should work but it doesn't... > > > > for tax in @taxes > > next if ! (tax.taxauthid === [ 24, 25, 26, 27, 36, 37, 38, 39]) > > print tax.taxamount + " - " + tax.taxauthid

[Rails] Re: for - next loop

2009-07-29 Thread Marnen Laibow-Koser
Craig White wrote: > Even my pickaxe book suggests this should work but it doesn't... > > for tax in @taxes > next if ! (tax.taxauthid === [ 24, 25, 26, 27, 36, 37, 38, 39]) > print tax.taxamount + " - " + tax.taxauthid + "\n" > end > > and my thinking is that if the tax.taxauthid is not fou

[Rails] Re: for - next loop

2009-07-29 Thread Zach Karpinski
In most cases that I see (according to the Pickaxe) this is "Case Equality" that is just a synonym to ==. On Jul 29, 3:00 am, Josh wrote: > I may be posting this twice, sorry if thats the case... > > Question, what is the difference between === and == > --~--~-~--~~~

[Rails] Re: for - next loop

2009-07-29 Thread Bryan Ash
If I understand correctly, you'd like to output some information about a selected group of taxes. How about something like: selected = @taxes.select { |tax| [24, 25, 26, 27, 36, 37, 38, 39].include? tax.taxauthid } selected.each { |tax| puts "#{tax.taxamount} - #{tax.taxauthid}" } Bryan --~--

[Rails] Re: for - next loop

2009-07-29 Thread Rakoth
difficult to provide anything more ugly > for tax in @taxes >   next if ! (tax.taxauthid === [ 24, 25, 26, 27, 36, 37, 38, 39]) >   print tax.taxamount + " - " + tax.taxauthid + "\n" > end --~--~-~--~~~---~--~~ You received this message because you are subscribed

[Rails] Re: for - next loop

2009-07-29 Thread Josh
I may be posting this twice, sorry if thats the case... Question, what is the difference between === and == If I were writing this I would write it with the member? method of array and avoid the next statement and the negation to make it as readable as possible. @taxes.each do |tax| if [24,

[Rails] Re: for - next loop

2009-07-29 Thread Josh
I am not familiar with 'triple equals' what is the difference between === and == If I were doing the same thing I'd write it @taxes.each do |tax| for tax in @taxes next if ! (tax.taxauthid === [ 24, 25, 26, 27, 36, 37, 38, 39]) print tax.taxamount + " - " + tax.taxauthid + "\n" end On Jul

[Rails] Re: for - next loop

2009-07-29 Thread Franz Strebel
> 2009/7/29 Craig White : >> >> Even my pickaxe book suggests this should work but it doesn't... >> >> for tax in @taxes >>  next if ! (tax.taxauthid === [ 24, 25, 26, 27, 36, 37, 38, 39]) >>  print tax.taxamount + " - " + tax.taxauthid + "\n" >> end Hello Craig, Why don't you use the include? m

[Rails] Re: for - next loop

2009-07-29 Thread Colin Law
2009/7/29 Craig White : > > Even my pickaxe book suggests this should work but it doesn't... > > for tax in @taxes >  next if ! (tax.taxauthid === [ 24, 25, 26, 27, 36, 37, 38, 39]) >  print tax.taxamount + " - " + tax.taxauthid + "\n" > end > > and my thinking is that if the tax.taxauthid is not