Remco Swoany wrote:
> Billy Hsu wrote:
>> [code]
>> ticket_fee = []find(:all).map{|record| ticket_fee << record.ticket_fees}
>> [/code]
>> 
>> Try it:)
>> btw, find(:all) you can write: 'all':
>> Ticket.find(:all) #=> Ticket.all
>> 
>> 
>> 
>> 
>> On Thu, Feb 26, 2009 at 5:17 PM, Remco Swoany <
>> [email protected]> wrote:
>> 
>>> cabinclass: nil, type: nil, eligibility: nil, supplier: nil, heen_datum:
>>> like this...
>>>
>> --
>> TWRUG Blog:
>> http://blog.rubyonrails.org.tw
>> 
>> CFC on Rails:
>> http://zusocfc.blogspot.com
>> 
>> Only two surfaces of a box:
>> http://blog.pixnet.net/zusocfc
> 
> Hi
> 
> Us this
> Factory_masters = Fusioncharts::FactoryMaster.find(:all)
> 
> Output:
>  [#<Fusioncharts::FactoryMaster id: 1, name: "vliegtickets">, 
> #<Fusioncharts::FactoryMaster id: 2, name: "vliegticket">, 
> #<Fusioncharts::FactoryMaster id: 3, name: "vliegtickets.nl">, 
> #<Fusioncharts::FactoryMaster id: 4, name: "www.vliegtickets.nl">, 
> #<Fusioncharts::FactoryMaster id: 5, name: "vlieg tickets">, 
> #<Fusioncharts::FactoryMaster id: 6, name: "vliegticket.nl">, 
> #<Fusioncharts::FactoryMaster id: 7, name: "goedkoop vliegen">, 
> #<Fusioncharts::FactoryMaster id: 8, name: "vliegtickets nl ">, 
> #<Fusioncharts::FactoryMaster id: 9, name: "vlieg ticket">, 
> #<Fusioncharts::FactoryMaster id: 10, name: "vliegtarieven">, 
> #<Fusioncharts::FactoryMaster id: 11, name: "vliegticket">]
> 
> Then i use your suggestion, like this
> 
> name = []Fusioncharts::FactoryMaster.find(:all).map{|record| name << 
> record.name
> 
> But i get no results...
> 
> What am i doing wrong?
> 
> remco

i just find out..the solution...pff..

factory_masters.bookings.map{|record| 
record.departure_id}.inject(Hash.new(0)) {|h,x| h[x]+=1;h}

output:

["AMS" => 4, "BCN"=> 9, "BKK"=>2]

Thanks for the support!
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to