Sha256: 557bc68d4e0621e489269409d841aa08fd86559f2ab41a315294235d8ecb3228

Contents?: true

Size: 564 Bytes

Versions: 62

Compression:

Stored size: 564 Bytes

Contents

ActiveRecord::Base.class_eval do

    def self.fields(include_in_migration = true, &b)
      # Any model that calls 'fields' gets a bunch of other
      # functionality included automatically, but make sure we only
      # include it once
      include HoboFields::Model unless HoboFields::Model.in?(included_modules)
      @include_in_migration ||= include_in_migration

      if b
        dsl = HoboFields::FieldDeclarationDsl.new(self)
        if b.arity == 1
          yield dsl
        else
          dsl.instance_eval(&b)
        end
      end
    end


end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
hobo_fields-2.2.6 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.2.5 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.2.4 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.2.3 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.2.2 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.2.1 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.2.0 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.1.2 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.1.1 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.1.0 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.1.0.pre4 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.1.0.pre3 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.1.0.pre2 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.1.0.pre1 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.0.1 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.0.0 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.0.0.pre10 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.0.0.pre9 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-2.0.0.pre8 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.3 lib/hobo_fields/extensions/active_record/fields_declaration.rb