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-1.3.0.RC1 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.RC lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre31 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre29 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre28 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre27 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre26 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre25 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre24 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre23 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre22 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre21 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre20 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre19 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre18 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre16 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre15 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre14 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre13 lib/hobo_fields/extensions/active_record/fields_declaration.rb
hobo_fields-1.3.0.pre12 lib/hobo_fields/extensions/active_record/fields_declaration.rb