Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created February 7, 2014 13:15
Show Gist options
  • Save jlebrech/8862433 to your computer and use it in GitHub Desktop.
Save jlebrech/8862433 to your computer and use it in GitHub Desktop.

Revisions

  1. jlebrech created this gist Feb 7, 2014.
    14 changes: 14 additions & 0 deletions my_form.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    require 'ostruct'
    class MyForm < OpenStruct
    include ActiveModel::Validations
    include ActiveModel::Conversion
    extend ActiveModel::Naming

    validates :name, :presence => true

    def initialize(*args)
    super
    end

    def persisted? ; false ; end;
    end