Hi,

I'm using the paperclip plugin for one of my rails app, but my problem
is pure Ruby. I'm not good enough with Ruby and lambdas so I need your
advice.

Here is the code I am trying to make work:

class Asset < ActiveRecord::Base

  has_attached_file :data, :styles => {
    :theora => [:format => :ogv, :processors => lambda {|a| a.video? ?
[:video_converter] : []}}]
}

end


What fails is the lambda, because in Paperclip behind the scenes this is
what happens:

@var = style.processors.inject(something) do |file, processor|
...
end

style.processors has received the lambda defined earlier.


And I get the following error message:

NoMethodError (undefined method `inject' for #<Proc:0x455d864>)


So how can I fix it, and after that which book or resources can I read
to get proficient in such dynamic coding practice? Currently in use
blocks all the time ([array].each { ...}) without really mastering them.

Thanks for your support
-- 
Posted via http://www.ruby-forum.com/.