Sha256: a773e7bae58018475805b10a3f2c339f838eb6a4061a1539acb8b65b93a4406c
Contents?: true
Size: 918 Bytes
Versions: 2
Compression:
Stored size: 918 Bytes
Contents
require 'active_form_model/version' module ActiveFormModel class Error < StandardError; end extend ActiveSupport::Concern included do prepend Included end module Included def initialize(attrs = {}) permitted_attrs = permit_attrs(attrs) super(permitted_attrs) end end module ClassMethods delegate :sti_name, to: :superclass delegate :human_attribute_name, to: :superclass # delegate :name, to: :superclass def permit(*args) @_permitted_args = args end def _permitted_args @_permitted_args || [] end end def update(attrs = {}) permitted_attrs = permit_attrs(attrs) super(permitted_attrs) end def update!(attrs = {}) permitted_attrs = permit_attrs(attrs) super(permitted_attrs) end def permit_attrs(attrs) attrs.respond_to?(:permit) ? attrs.send(:permit, self.class._permitted_args) : attrs end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_form_model-0.2.0 | lib/active_form_model.rb |
active_form_model-0.1.0 | lib/active_form_model.rb |