Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow_blank on serial_id #73

Merged
merged 1 commit into from
Mar 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Host < ActiveRecord::Base
validates :name, presence: true, uniqueness: true, length: { maximum: 100 }, format: { with: /\A[^\/]+\Z/ }
validates :ip_address, format: { with: /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ }, allow_blank: true
validates :description, length: { maximum: 255 }
validates :serial_id, uniqueness: true, length: { maximum: 128 }, format: { with: /\A[^\/]*\Z/ }
validates :serial_id, allow_blank: true, uniqueness: true, length: { maximum: 128 }, format: { with: /\A[^\/]*\Z/ }

has_many :host_relations, dependent: :delete_all
has_many :services, through: :host_relations
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20130305171636_remove_serial_id_index_on_host.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveSerialIdIndexOnHost < ActiveRecord::Migration
def change
remove_index :hosts, :serial_id
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20121210144811) do
ActiveRecord::Schema.define(version: 20130305171636) do

create_table "activities", force: true do |t|
t.integer "user_id"
Expand Down Expand Up @@ -53,7 +53,6 @@
end

add_index "hosts", ["name"], name: "index_hosts_on_name", unique: true
add_index "hosts", ["serial_id"], name: "index_hosts_on_serial_id", unique: true

create_table "roles", force: true do |t|
t.string "name"
Expand Down