File_column - assigning with an actual file rather than a mu

Hi there,

I’m using the wonderful file_column and have struck an issue that
someone might have seen before.

My images already sit on the server. So, instead of passing a
multipart message I’m sending a file object.

Something like…

f = File.new(“public/gallery_images/builder.png”)
p = Product.find_first
p.image = f
p.save

On the save I recieve an error which I’ve pasted at the bottom of this
mail.

A temporary image is created in the correct place so I’m almost there.
Any ideas? I haven’t heard of anyone doing this but file_column.rb#47
said I could.

Thanks
-h

NoMethodError: undefined method empty?' for 0:Fixnum from ./script/../config/../config/../vendor/plugins/file_column/lib/file_column.rb:351:ininitialize’
from
./script/…/config/…/config/…/vendor/plugins/file_column/lib/file_column.rb:135:in
clone_as' from ./script/../config/../config/../vendor/plugins/file_column/lib/file_column.rb:309:inafter_save’
from
./script/…/config/…/config/…/vendor/plugins/file_column/lib/file_column.rb:673:in
image_after_save' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/callbacks.rb:333:incallback’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/callbacks.rb:330:in
callback' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/callbacks.rb:250:increate_or_update’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/base.rb:1392:in
save_without_validation' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/validations.rb:724:insave_without_transactions’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/transactions.rb:126:in
save' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/abstract/database_statements.rb:51:intransaction’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/transactions.rb:91:in
transaction' from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/transactions.rb:118:intransaction’
from
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/transactions.rb:126:in
`save’
from (irb):17

Oops, dont worry about that… I had the field type set to integer
rather than string. Good one dumbdumb.

-h

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs