-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
iarie
committed
Apr 5, 2017
1 parent
d0a1010
commit 7e2d03f
Showing
3 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
class Country < ActiveRecord::Base | ||
validates :code, presence: true | ||
validates :name, presence: true | ||
validates :code, :name, presence: true | ||
end |
3 changes: 1 addition & 2 deletions
3
spec/example_app/db/migrate/20170331144723_create_countries.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
class CreateCountries < ActiveRecord::Migration | ||
def change | ||
create_table :countries do |t| | ||
t.string :code | ||
t.string :code, null: false, index: { unique: true } | ||
t.string :name | ||
|
||
t.timestamps null: false | ||
end | ||
add_index :countries, :code, unique: true | ||
add_column :customers, :country_code, :string, index: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters