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 :
undef开发者_JAVA百科ined 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.
精彩评论