Rails 3, mongoid and paperclip compatibility

184 views
Skip to first unread message

chatgris

unread,
Feb 21, 2010, 1:32:51 PM2/21/10
to carrierwave
Hello guys,

I'm having somes troubles making the paperclip compatibility working
on rails 3.0, with the mongoid orm.

Here's my model :

require 'carrierwave/orm/mongoid'

class Art

include Mongoid::Document
include Mongoid::Timestamps

field :title, :type => String
field :permalink, :type => String
field :content, :type => String
field :hit, :type => Integer, :default => 0
field :art, :type => String
field :art_file_name, :type => String

belongs_to_related :category

mount_uploader :art, ArtUploader, :mount_on => :art_file_name

end

And my uploader :

class ArtUploader < CarrierWave::Uploader::Base
include CarrierWave::Compatibility::Paperclip
include CarrierWave::RMagick
storage :file

def store_dir
":rails_root/public/gribouillis"
end

def paperclip_path
":rails_root/public/gribouillis/:style/:basename.:extension"
end

version :thumb do
process :resize_to_fit => [200,200]
end

end

This works great without the paperclip compatibility, but when it's
on, i've got this errorfrom the create method :

invalid value for Integer: "4b817b28af078e1257000005"

My gemfile :

gem "rails", "3.0.0.beta"
gem "mongo"
gem "mongo_ext"
gem "mongoid", :git => "git://github.com/durran/mongoid.git", :branch
=> "prerelease"
gem "carrierwave", :git => "git://github.com/jnicklas/carrierwave.git"


Am I missing something here ?

Jonas Nicklas

unread,
Feb 21, 2010, 7:25:20 PM2/21/10
to carri...@googlegroups.com
Stack trace plz ;)

/Jonas

chatgris

unread,
Feb 23, 2010, 3:13:03 PM2/23/10
to carrierwave
Sure.

i18n (0.3.3) lib/i18n/core_ext/string/interpolate.rb:91:in
`interpolate_without_ruby_19_syntax'
i18n (0.3.3) lib/i18n/core_ext/string/interpolate.rb:91:in `send'
i18n (0.3.3) lib/i18n/core_ext/string/interpolate.rb:91:in `%'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/compatibility/paperclip.rb:85:in `mappings'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/compatibility/paperclip.rb:75:in `call'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/compatibility/paperclip.rb:75:in
`interpolate_paperclip_path'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/multibyte/chars.rb:580:in `inject'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/compatibility/paperclip.rb:74:in `each'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/compatibility/paperclip.rb:74:in `inject'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/compatibility/paperclip.rb:74:in
`interpolate_paperclip_path'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/compatibility/paperclip.rb:53:in `store_path'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/storage/file.rb:25:in `store!'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/uploader/store.rb:59:in `store!'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/uploader/callbacks.rb:14:in `with_callbacks'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/uploader/store.rb:58:in `store!'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/mount.rb:325:in `store!'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/carrierwave/lib/
carrierwave/mount.rb:216:in `store_art!'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/callbacks.rb:429:in `_run_save_callbacks'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/callbacks.rb:88:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta/lib/
active_support/callbacks.rb:88:in `run_callbacks'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/mongoid-prerelease/lib/
mongoid/commands/save.rb:15:in `execute'
/home/chatgris/.bundle/ruby/1.8/bundler/gems/mongoid-prerelease/lib/
mongoid/commands.rb:57:in `save'


Julien


On Feb 22, 1:25 am, Jonas Nicklas <jonas.nick...@gmail.com> wrote:
> Stack trace plz ;)
>
> /Jonas
>

Jonas Nicklas

unread,
Feb 26, 2010, 11:51:37 AM2/26/10
to carri...@googlegroups.com

chatgris

unread,
Feb 28, 2010, 8:15:52 AM2/28/10
to carrierwave
Hello,

This commit fixed the issue.

Thanks !


Julien


On Feb 26, 5:51 pm, Jonas Nicklas <jonas.nick...@gmail.com> wrote:
> Couls you check if this commit
>

> http://github.com/jnicklas/carrierwave/commit/fc3f1d7e1f8270e3ffb4e3c...
>
> fixed it?
>
> /Jonas

Reply all
Reply to author
Forward
0 new messages