mardi 4 août 2015

How to reference a file outside of model in Rails?

I'm adding the carrierwave gem to an app in Rails, and I'm getting a weird NameError. I've followed all other posts on it, yet none of them worked. Here's the error:

uninitialized constant Post::ImageUploader

Extracted source (around line #2):
class Post < ActiveRecord::Base
  mount_uploader :image, ImageUploader
end

And post.rb:

class Post < ActiveRecord::Base
  mount_uploader :image, ImageUploader
end

Also, here's one site that I went to, but it didn't describe where to place the code, so I got really confused.

Can anyone help me figure out what's going on? Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire