Sha256: ed0ca7aa38000bbc7f42cf5721c56d7a694e0ee82184569ca74f809405091179

Contents?: true

Size: 692 Bytes

Versions: 3

Compression:

Stored size: 692 Bytes

Contents

# coding: utf-8
module UploadifyRails
  module Models
    module Resource
      def self.included(base)
        base.extend ClassMethods
      end

      module ClassMethods
        def uploadify_nested_resource
          unless included_modules.include? InstanceMethods
            include InstanceMethods
          end
        end
      end

      module InstanceMethods
        def build_nested_resource(params, user)
          params[:Filedata].content_type = MIME::Types.type_for(params[:Filedata].original_filename).first
          self.data = params[:Filedata]
          self.session_id = params[:_session_id]
          self.user = user if user
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uploadify_rails-0.0.15 lib/uploadify_rails/models/resource.rb
uploadify_rails-0.0.14 lib/uploadify_rails/models/resource.rb
uploadify_rails-0.0.12 lib/uploadify_rails/models/resource.rb