Sha256: 803a81ef7ada96a4ea420bd4d3fc21f7c3171b0231bb11b0f54b68e405e51349
Contents?: true
Size: 926 Bytes
Versions: 22
Compression:
Stored size: 926 Bytes
Contents
module Datagrid # Required to be ActiveModel compatible # @private module ActiveModel #:nodoc: def self.included(base) base.extend ClassMethods base.class_eval do begin require 'active_model/naming' extend ::ActiveModel::Naming rescue LoadError end end base.send :include, InstanceMethods end # self.included module ClassMethods def param_name self.to_s.underscore.tr('/', '_') end end # ClassMethods module InstanceMethods def param_name self.class.param_name end def param_key param_name end def to_key [self.class.param_name] end def persisted? false end def to_model self end def to_param self.param_name end end # InstanceMethods end end
Version data entries
22 entries across 22 versions & 1 rubygems