Sha256: aa63784550fa5865da3eed05b530804a66b46c8a3c40f6b49ac207909f63d25c

Contents?: true

Size: 682 Bytes

Versions: 17

Compression:

Stored size: 682 Bytes

Contents

#require 'rails_admin/config/fields/base'
module RailsAdmin::Config::Fields::Types
  class Uploader < RailsAdmin::Config::Fields::Types::Text
    RailsAdmin::Config::Fields::Types::register(:rails_uploader, self)

    register_instance_option(:config) do
      {}
    end

    register_instance_option(:partial) do
      :form_rails_uploader
    end

    def scope_type
      # Use association name if existent
      if bindings[:form].object_name.scan(/.*\[(.*)_attributes\]/).nil?
        bindings[:form].object_name
      else
        bindings[:form].object_name.scan(/.*\[(.*)_attributes\]/).to_s
      end
    end

    def scope_id
      bindings[:object].id
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
glebtv-rails-uploader-0.12.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.11.1 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.11.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.10.1 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.10.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.9.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.8.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.7.1 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.7.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.6.1 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.6.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.5.1 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.5.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.4.1 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.4.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.3.0 lib/uploader/rails_admin/field.rb
glebtv-rails-uploader-0.2.0 lib/uploader/rails_admin/field.rb