undefined method 'dragonfly_accessor'

2019-04-10 17:56发布

I am new to dragonfly and trying to go through the setup directions on the main documentation page for rails. Not using Active Record.

My steps:

1) add to Gemfile

gem 'dragonfly', "~>1.0.3"

2) bundle install

3) rails g dragonfly

created initializers/dragonfly.rb

4) model

class Post

  include Mongoid::Document

  dragonfly_accessor :image

  field :title, type: String

  field :body, type: String

end

5) controller

params.require(:post).permit(:title, :body, :image)

Just running mongod and rails s, I get the error of undefined method 'dragonfly_accessor'

Any ideas what I am missing?

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-04-10 18:40

Also, the user’s error is that he’s not inheriting from ActiveRecord::Base. Documentation is here. (https://github.com/markevans/dragonfly)

查看更多
登录 后发表回答