Skip to content

Commit da77bdc

Browse files
committed
revert adding name to form
1 parent b102020 commit da77bdc

File tree

4 files changed

+0
-17
lines changed

4 files changed

+0
-17
lines changed

Diff for: db/migrate/20170430190404_create_forms.rb

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
class CreateForms < ActiveRecord::Migration[5.1]
44
def change
55
create_table :forms do |t|
6-
t.string :name, null: false, index: { unique: true }
76
t.string :type, null: false, index: true
87

98
t.timestamps

Diff for: lib/form_core/concerns/models/form.rb

-10
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ module Models
55
module Form
66
extend ActiveSupport::Concern
77

8-
NAME_REGEX = /\A[a-z][a-z_0-9]*\z/.freeze
9-
10-
included do
11-
validates :name,
12-
presence: true,
13-
uniqueness: true,
14-
exclusion: { in: FormCore.reserved_names },
15-
format: { with: NAME_REGEX }
16-
end
17-
188
def to_virtual_model(model_name: "Form",
199
fields_scope: proc { |fields| fields },
2010
overrides: {})

Diff for: test/dummy/app/models/metal_form.rb

-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,5 @@ class MetalForm < ApplicationRecord
77

88
has_many :fields, foreign_key: "form_id"
99

10-
default_value_for :name,
11-
->(_) { "form_#{SecureRandom.hex(3)}" },
12-
allow_nil: false
13-
1410
include Forms::Fake
1511
end

Diff for: test/dummy/db/schema.rb

-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
end
7171

7272
create_table "forms", force: :cascade do |t|
73-
t.string "name", null: false
7473
t.string "type", null: false
7574
t.datetime "created_at", null: false
7675
t.datetime "updated_at", null: false
@@ -79,7 +78,6 @@
7978
t.string "attachable_type"
8079
t.integer "attachable_id"
8180
t.index ["attachable_type", "attachable_id"], name: "index_forms_on_attachable_type_and_attachable_id"
82-
t.index ["name"], name: "index_forms_on_name", unique: true
8381
t.index ["type"], name: "index_forms_on_type"
8482
end
8583

0 commit comments

Comments
 (0)