0

I'm using axlsx-rails to generate excel sheets that contain the info that is in my User entity. the problem arises when i try to put an image in the excel sheet. I'm using carrierwave 0.11.2 and I've made sure that I have set it up correctly, I have the string column profile_pic that holds the image, I have the uploader PicUploader and it's mounted to User. the carrierwave implementation works fine, and the picture shows in the user's "show" page but when i try to follow the axlsx example to put the image in the sheet as such

 img = File.expand_path(@user.profile_pic, __FILE__)
sheet.add_image(:image_src => img, :noSelect => true, :noMove => true) do |image|
        image.width=420
        image.height=669
    end

I get the TypeError no implicit conversion of PicUploader into String
Any idea what might be causing this ?

Kusum
  • 501
  • 2
  • 11
  • 30
AmyAdamsIsBae
  • 41
  • 1
  • 7

1 Answers1

1

It is saying that expand_path expects a string, not a PicUploader class as parameter. Try

img = File.expand_path(@user.profile_pic.current_path, __FILE__)
Ursus
  • 29,643
  • 3
  • 33
  • 50
  • kinda unrelated follow-up: the image seems to ignore my `image.start_at` and always starts at A1 (i can, however change the `end_at`). do you have any idea why this could be happening ? – AmyAdamsIsBae Aug 04 '16 at 12:45
  • I'm sorry but I don't know what you're talking about :( open another question with the involved code, please. – Ursus Aug 04 '16 at 12:48