May be it's not the perfect way, but it works.
I've made several versions of uploaded files in: redactor_rails_picture_uploader.rb
version :item_text do
process :resize_to_limit => [478, 478]
end
version :thumb do
process :resize_to_fill => [100, 100]
end
Created initializer and redefined method 'create' of class RedactorRails::PicturesController there. Now it saves the version that I pass with the form by 'version' param.
RedactorRails::PicturesController.class_eval do
def create
@picture = RedactorRails::Picture.new
file = params[:file]
version = params[:version]
@picture.data = RedactorRails::Http.normalize_param(file, request)
if @picture.respond_to?(:user_id)
@picture.user = current_user
@picture.assetable = current_user
end
if @picture.save
if version
file_link = @picture.send(:url, version)
else
file_link = @picture.url
end
render :text => { :filelink => file_link }.to_json
else
render :nothing => true
end
end
end
Finally added hidden input with the value of the version from uploader I want to save in this form:
%input{:id => 'redactor_version', :value => 'item_text', :type => 'hidden'}
Something like this.