Sha256: 88a515ffd356bcc7ea0c1ff4ef15554afc7136375c2ce01d0c9ac03d03bae147

Contents?: true

Size: 976 Bytes

Versions: 12

Compression:

Stored size: 976 Bytes

Contents

require 'rails_admin/config/fields/association'

module RailsAdmin
  module Config
    module Fields
      module Types
        class HasManyAssociation < RailsAdmin::Config::Fields::Association
          # Register field type for the type loader
          RailsAdmin::Config::Fields::Types.register(self)

          register_instance_option :partial do
            nested_form ? :form_nested_many : :form_filtering_multiselect
          end

          # orderable associated objects
          register_instance_option :orderable do
            false
          end

          register_instance_option :inline_add do
            true
          end

          def method_name
            nested_form ? "#{super}_attributes".to_sym : "#{super.to_s.singularize}_ids".to_sym  # name_ids
          end

          # Reader for validation errors of the bound object
          def errors
            bindings[:object].errors[name]
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
rails_admin-1.0.0.rc lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.8.1 lib/rails_admin/config/fields/types/has_many_association.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rails_admin-0.7.0/lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.7.0 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.8 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.7 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.6 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.5 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.4 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.3 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.2 lib/rails_admin/config/fields/types/has_many_association.rb
rails_admin-0.6.1 lib/rails_admin/config/fields/types/has_many_association.rb