undefined method 'dragonfly_accessor'

我的梦境 提交于 2019-12-06 08:27:11

问题


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:


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



来源:https://stackoverflow.com/questions/21691261/undefined-method-dragonfly-accessor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!