Sha256: 92056004174eee7bdb2e03ca578236daf6e1abb984a1c0158bbcf9867406d410

Contents?: true

Size: 726 Bytes

Versions: 12

Compression:

Stored size: 726 Bytes

Contents

require "reform/form/orm"

module Reform::Form::ActiveRecord
  def self.included(base)
    base.class_eval do
      register_feature Reform::Form::ActiveRecord
      include Reform::Form::ActiveModel
      include Reform::Form::ORM
      extend ClassMethods
    end
  end

  module ClassMethods
    def validates_uniqueness_of(attribute, options={})
      options = options.merge(:attributes => [attribute])
      validates_with(UniquenessValidator, options)
    end
    def i18n_scope
      :activerecord
    end
  end

  def to_nested_hash(*)
    super.with_indifferent_access
  end

  class UniquenessValidator < ::ActiveRecord::Validations::UniquenessValidator
    include Reform::Form::ORM::UniquenessValidator
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
reform-rails-0.2.0.rc2 lib/reform/form/active_record.rb
reform-rails-0.2.0.rc1 lib/reform/form/active_record.rb
reform-rails-0.1.7 lib/reform/form/active_record.rb
reform-rails-0.1.5 lib/reform/form/active_record.rb
reform-rails-0.1.4 lib/reform/form/active_record.rb
reform-rails-0.1.3 lib/reform/form/active_record.rb
reform-rails-0.1.2 lib/reform/form/active_record.rb
reform-rails-0.1.1 lib/reform/form/active_record.rb
reform-2.1.0 lib/reform/form/active_record.rb
reform-2.1.0.rc1 lib/reform/form/active_record.rb
reform-2.0.5 lib/reform/form/active_record.rb
reform-2.0.4 lib/reform/form/active_record.rb