module Form::ActiveModel

Public Class Methods

included(base) click to toggle source
# File lib/reform/form/active_model.rb, line 2
def self.included(base)
  base.class_eval do
    extend ClassMethods
    register_feature ActiveModel

    delegations = Module.new do
      delegate :persisted?, :to_key, :to_param, :id, to: :model
    end

    include delegations # now, those methods (e.g. {#persisted?}) can be overridden by another module.

    def to_model # this is called somewhere in FormBuilder and ActionController.
      self
    end
  end
end

Public Instance Methods

model_name(*args) click to toggle source
# File lib/reform/form/active_model.rb, line 98
def model_name(*args)
  self.class.model_name(*args)
end
to_model() click to toggle source
# File lib/reform/form/active_model.rb, line 13
def to_model # this is called somewhere in FormBuilder and ActionController.
  self
end