ruby on rails - Rake Task doesn't load Model with Paperclip -


in rake task production migrate assets want require model uses paperclip. error

nomethoderror: undefined method `has_attached_file' #<class:0x00000006c12680> ~/.rvm/gems/ruby-2.0.0-p247/gems/activerecord-3.2.18/lib/active_recor/dynamic_matchers.rb:55:in `method_missing' /app/models/user.rb:74:in `<class:user>' 

line 74 declares attachment:

has_attached_file :photo, styles: { original: '1024x1024>', s64: ["64x64#", "jpg"] }, :convert_options => { original: "-quality 85 -strip", s64: "-quality 85 -strip" }, processors: [:trimmer, :cropper], url: '/system/product/:attachment/:id/:style/:filename', path: ':rails_root/public/system/product/:attachment/:id/:style/:filename' 

from rakefile: lib/task/asset.rake

task :preload => :environment    require 'user' end 

i tried require 'paperclip' before 'user', didn't help.

the problem seemed have beeen unfourtune choice of namespace "assets", seems interfere rails defining namespace already. ends here similiar question: try changing namespace unique , see if error disappears :)


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -