I updated an application from 3.0.10 to 3.0.14, and now I’m getting an
error of
NoMethodError (undefined method collect' for #<Mysql::Result:0x9b89bc0>): app/models/attachment.rb:20:in
set_uid’
app/controllers/attachments_controller.rb:24:in `create’
It’s being triggered by the call to Attachment.find_by_uid in this
method, which is called in a before_create callback in attachment.rb:
def set_uid
code = Array.new(7) { ((‘A’…‘Z’).to_a + (0…9).to_a)[rand(36)]
}.join.to_s
if Attachment.find_by_uid(code)
return self.set_uid()
else
self.uid = code
end
end
This works perfectly in 3.0.10, and fails in 3.0.14. One other wrinkle,
this is using the mysql (not mysql2) adapter, as I can’t get mysql2 to
build on my Joyent SmartOS server.