Sha256: 88e22b76b9501d1307f551be55cee8e276cf680c659cc472f3bbd9fd5e6c4051
Contents?: true
Size: 904 Bytes
Versions: 24
Compression:
Stored size: 904 Bytes
Contents
module Datagrid # Required to be ActiveModel compatible module ActiveModel 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
24 entries across 24 versions & 1 rubygems