Forum: Ruby on Rails rake printing instance variable to console

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.
Gokhan A. (Guest)
on 2007-03-28 12:21
Hello All,

My small issue is that following rake task is printing my instance
variable to console, but I do not want any output accept my "put"
statement.

Data field is a blob and contains binary data and when printed to my
console it is huge amount of data. I dont wanna see it at all.

Any suggestions? Thanks

    desc "Migrate images from attachments to fleximage."
    task :migrate => [:environment] do |t|
       Asset.find(:all, :conditions=>"parent_id is NULL").each do |a|
         image_file = RAILS_ROOT + "/public" + a.public_name_for
         puts "Working on " + image_file
         i = Image.create(
                       :data => image_file,
                       :author_id   => a.author_id,
                       :author_ip   => a.author_ip
                       )
         ActiveRecord::Base.connection.execute("update images set id =
#{a.id} where id = #{i.id}")
       end
     end
This topic is locked and can not be replied to.