Sha256: 2dce39fc9e078f19f80369fc76163b237472cd90399002cab1a8004f9df793b2
Contents?: true
Size: 702 Bytes
Versions: 3
Compression:
Stored size: 702 Bytes
Contents
# UnpersistentModel allows the ActiveForm::Form object to delegate methods to # this object with expected results # # - #model_name is used by Form helpers & Rails frequently to define the form namespace # - #to_key, #to_param, #id should aways return nil as the Form cannot be persisted unless backed by ActiveModel # - #persisted? should aways return false as the Form cannot be persisted unless backed by ActiveModel # module ActiveForm::Form class UnpersistentModel attr_reader :to_key, :to_param, :id def initialize(base_klass) @base_class = base_klass end def model_name ActiveModel::Name.new(@base_class) end def persisted? false end end end
Version data entries
3 entries across 3 versions & 1 rubygems