Forum: Ruby on Rails CSV::Writer and Rails 1.2.3

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Craig W. (Guest)
on 2007-04-13 21:06
(Received via mailing list)
This seems to no longer work...

http://www.ruby-doc.org/core/classes/CSV/Writer.html

from my console session (lifting code from my application)

 >>     @qm_monitorings = QmMonitoring.find(:all)
 => [#<QmMonitoring:0xb74d72b0
@attributes={"qm_mon_month_year"=>"2007-03-01", "facility_id"=>"12",
"id"=>"1", "num_charts_reviewed"=>"5"}>]
 >> report = StringIO.new
 => #<StringIO:0xb74d59b0>
 >> CSV::Writer.generate(report, ',') do |csv|
 ?> csv << %w(Facility Date Charts_reviewed Type Qty)
 >> @qm_monitorings.each do |qm|
 ?>         @qm_monitoring_data =
 QmMonitoringData.find(:all, :conditions => ["qm_monitoring_id = ?",
qm.id], :order => 'qm_data_type')
 >>         for qm_monitoring_data in @qm_monitoring_data
 >>           csv << [qm.facility.name, qm.qm_mon_month_year,
qm.num_charts_reviewed, qm_monitoring_data.qm_data_type,
qm_monitoring_data.qm_charts]
 >>         end
 >>       end
 >>     end
NameError: uninitialized constant CSV

from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in
`load_missing_constant'

from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:452:in
`const_missing'

from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:464:in
`const_missing'
        from (irb):4
>>
--
Craig W. <removed_email_address@domain.invalid>
jimache (Guest)
on 2007-04-13 21:48
(Received via mailing list)
... try adding require 'csv' ... i had the same problem with the
CSV::Reader.parse
Craig W. (Guest)
on 2007-04-13 22:01
(Received via mailing list)
yep...thanks

It seems that the biggest problems that I have had in the Rails 1.2.x
upgrade came from Ruby modules

Craig

On Fri, 2007-04-13 at 10:48 -0700, jimache wrote:
> >
> >  QmMonitoringData.find(:all, :conditions => ["qm_monitoring_id = ?",
> > from 
/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependen�cies.rb:266:in 
`load_missing_constant'
> >
--
Craig W. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.