Sha256: 95fb1748c1d82cfad085713ea2cb88e1b20d747ea3ab67216287676c32a4d3b4
Contents?: true
Size: 603 Bytes
Versions: 2
Compression:
Stored size: 603 Bytes
Contents
class Id::ActiveModel include ActiveModel::Conversion include ActiveModel::Validations def self.i18n_scope :id end def initialize(model, data) @model = model @data = data end def to_partial_path model.respond_to?(:to_partial_path) ? model.to_partial_path : super end def respond_to?(name, include_private = false) super || model.respond_to?(name, include_private) end private def method_missing(name, *args, &block) field = model.fields[name] field.nil? ? model.send(name, *args, &block) : data[field.key] end attr_reader :model, :data end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
id-0.1.1 | lib/id/active_model.rb |
id-0.1 | lib/id/active_model.rb |