简体   繁体   中英

public_filename method is undefined for attachment_fu in ruby 1.9

I'm upgrading a RoR app that I inherited, from 1.8.7/2.3.? to 1.9/3.0.9 The app uses attachemnt_fu to allow users to upload photos, but when I try to display a photo on the home page, I get:

undefined method `public_filename' for "#<Photo:0x000000049f3838>":Photo

The model photo class that has_attachment is loading DB data (can see it in the debugger), but all the attachment_fu methods are 'undefined'. Same with any method explicitly defined in the model class (so is possible that it is not attachment_fu related)

Using attachment_fu which claims compatibility with rails 3.0.3

As usual, I was looking in the wrong place.

The problem was the upgrade to attachment_fu, and I think the solution was buried in the documentation. As near as I can tell, the plugin upgrade did not work on my install - it left the older non-rails 3 compatible library on my disk, where ruby diligently hunted it down and loaded it.

When I searched my disk and manually 'rm'ed all trace of the older installation, the method was suddenly no longer undefined.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM