Calling a function

Hi. I'm trying to call the function 'store_description(image)' at line 9. However when I do, I get the error "undefined method 'store_description' for Photo:Class". What can I do?

1: class Photo < ActiveRecord::Base 2: def store_description (image) 3: self.description = "size: "+number_to_human_size(image.filesize) 4: end 5: file_column :image, :magick => { 6: :versions => { 7: "thumb" => { 8: :transformation => Proc.new { |image| 9: store_description(image) # what do I put here??? 10: image.change_geometry!('160x120') { |cols, rows, img| 11: img.thumbnail!(cols, rows) 12: } 13: }, 14: :attributes => { :quality => 50 } 15: } 16: } 17: } 18: end

Thanks!

On line 2, try: def self.store_description (image)

Okay, I've tried that, and the function runs now (progress!) however I now get the following error:     undefined method `number_to_human_size' for Photo:Class

If I eliminate the 'number_to_human_size' then I get the error:     undefined method `description=' for Photo:Class

Any ideas?

Let's try this:

Change line 2 to: def store_description (image) Change line 9 to: self.store_description(image)

If that doesn't work, try having them both be self.

Okay, I tried those both. The first suggestion triggers this familiar error:     undefined method 'store_description' for Photo:Class

And the second, this one:     undefined method `description=' for Photo:Class

Surely what I'm trying to do isn't that odd?