Sha256: d8a28ca0abb5d77b404c4e045a2351239be1ec8f5a291caf4e2bf963bb31f3f9

Contents?: true

Size: 524 Bytes

Versions: 36

Compression:

Stored size: 524 Bytes

Contents

# Form Object for the filters form

module Effective
  class DatatableFiltersForm
    include ActiveModel::Model

    attr_accessor :scope

    def initialize(datatable:)
      # Assign the current value of scope
      assign_attributes(scope: datatable.state[:scope])

      # Create an attr_accesor for each filter and assign value
      datatable._filters.each do |name, options|
        self.class.send(:attr_accessor, name)
        assign_attributes(name => datatable.state[:filter][name])
      end
    end

  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
effective_datatables-4.20.4 app/models/effective/datatable_filters_form.rb
effective_datatables-4.20.3 app/models/effective/datatable_filters_form.rb
effective_datatables-4.20.2 app/models/effective/datatable_filters_form.rb
effective_datatables-4.20.1 app/models/effective/datatable_filters_form.rb
effective_datatables-4.20.0 app/models/effective/datatable_filters_form.rb
effective_datatables-4.19.1 app/models/effective/datatable_filters_form.rb
effective_datatables-4.19.0 app/models/effective/datatable_filters_form.rb
effective_datatables-4.18.0 app/models/effective/datatable_filters_form.rb
effective_datatables-4.17.4 app/models/effective/datatable_filters_form.rb
effective_datatables-4.17.3 app/models/effective/datatable_filters_form.rb
effective_datatables-4.17.2 app/models/effective/datatable_filters_form.rb
effective_datatables-4.17.1 app/models/effective/datatable_filters_form.rb
effective_datatables-4.17.0 app/models/effective/datatable_filters_form.rb
effective_datatables-4.16.2 app/models/effective/datatable_filters_form.rb
effective_datatables-4.16.1 app/models/effective/datatable_filters_form.rb
effective_datatables-4.16.0 app/models/effective/datatable_filters_form.rb