module Datagrid::ActiveModel

Required to be ActiveModel compatible

Public Class Methods

included(base) click to toggle source

@!visibility private

# File lib/datagrid/active_model.rb, line 5
def self.included(base)
  base.extend         ClassMethods
  base.class_eval do
    begin
      require 'active_model/naming'
      extend ::ActiveModel::Naming
    rescue LoadError
    end
    begin
      require 'active_model/attributes_assignment'
      extend ::ActiveModel::AttributesAssignment
    rescue LoadError
    end
  end
end

Public Instance Methods

param_key() click to toggle source

@return [String] URL query parameter name of the grid class

# File lib/datagrid/active_model.rb, line 34
def param_key
  param_name
end
param_name() click to toggle source

@return [String] URL query parameter name of the grid class

# File lib/datagrid/active_model.rb, line 29
def param_name
  self.class.param_name
end
persisted?() click to toggle source
# File lib/datagrid/active_model.rb, line 42
def persisted?
  false
end
to_key() click to toggle source
# File lib/datagrid/active_model.rb, line 38
def to_key
  [self.class.param_name]
end
to_model() click to toggle source
# File lib/datagrid/active_model.rb, line 46
def to_model
  self
end
to_param() click to toggle source
# File lib/datagrid/active_model.rb, line 50
def to_param
  self.param_name
end