Sha256: 73b2c24e61ac6aa5d2b0ccadf7d89d2a7830892b1f1489a09bdf50f8eea93aae

Contents?: true

Size: 556 Bytes

Versions: 18

Compression:

Stored size: 556 Bytes

Contents

# kind of the evolution of the FormStruct

module Edifice
  class FormModel
    include ActiveModel::Validations
    include ActiveModel::Conversion
    extend  ActiveModel::Naming
    
    def initialize(attributes = {})
        attributes.each { |n, v| send("#{n}=", v) if respond_to?("#{n}=") }
    end
    
    # default implementation, override as necessary
    def save
      valid?
    end
    
    def self.create(attributes = {})
      form = new(attributes)
      form.save
      form
    end
    
    def persisted?
      false
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
edifice-0.10.0 lib/edifice/form_model.rb
edifice-0.9.0 lib/edifice/form_model.rb
edifice-0.8.0 lib/edifice/form_model.rb
edifice-0.7.3 lib/edifice/form_model.rb
edifice-0.7.2 lib/edifice/form_model.rb
edifice-0.7.1 lib/edifice/form_model.rb
edifice-0.7.0 lib/edifice/form_model.rb
edifice-0.6.9 lib/edifice/form_model.rb
edifice-0.6.8 lib/edifice/form_model.rb
edifice-0.6.7 lib/edifice/form_model.rb
edifice-0.6.6 lib/edifice/form_model.rb
edifice-0.6.5 lib/edifice/form_model.rb
edifice-0.6.4 lib/edifice/form_model.rb
edifice-0.6.3 lib/edifice/form_model.rb
edifice-0.6.2 lib/edifice/form_model.rb
edifice-0.6.1 lib/edifice/form_model.rb
edifice-0.6.0 lib/edifice/form_model.rb
edifice-0.5.0 lib/edifice/form_model.rb