Skip to content

Commit 9848993

Browse files
authored
Merge pull request #175 from coderdojo-japan/prefectures
Prefectures
2 parents 346005a + b039454 commit 9848993

File tree

9 files changed

+190
-1
lines changed

9 files changed

+190
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Fulfill the requirements, setup by following the instructions, and send a pull r
2626
1. Fork and clone this repository.
2727
1. `$ bundle install --without production`
2828
1. `$ bundle exec rails db:migrate`
29+
1. `$ bundle exec rails db:seed`
2930
1. `$ bundle exec rails dojos:update_db_by_yaml`
3031
1. `$ bundle exec rails dojo_event_services:upsert`
3132
1. `$ bundle exec rails test`

app/models/dojo.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class Dojo < ApplicationRecord
33
NUM_OF_WHOLE_DOJOS = "1,400"
44
NUM_OF_JAPAN_DOJOS = Dojo.count.to_s
55

6+
belongs_to :prefecture
67
has_one :dojo_event_service, dependent: :destroy
78
has_many :event_histories, dependent: :destroy
89

app/models/prefecture.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Prefecture < ApplicationRecord
2+
validates :name, presence: true, uniqueness: true
3+
validates :region, presence: true
4+
end

0 commit comments

Comments
 (0)