diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-11-27 10:59:43 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-12-04 09:32:44 +0000 |
commit | abc1b8069da09d3ef8523ed64c60b2790a41bf01 (patch) | |
tree | df0dfefd4bbcca2804a376691f530770ef7f2f8b | |
parent | d0127de6aad534cd7ec6244ca7f000aeed8a9756 (diff) |
Add association between batches and public bodies.
-rw-r--r-- | app/models/info_request_batch.rb | 1 | ||||
-rw-r--r-- | db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/app/models/info_request_batch.rb b/app/models/info_request_batch.rb index 1a2605e36..c4075e5e4 100644 --- a/app/models/info_request_batch.rb +++ b/app/models/info_request_batch.rb @@ -13,6 +13,7 @@ class InfoRequestBatch < ActiveRecord::Base has_many :info_requests belongs_to :user + has_and_belongs_to_many :public_bodies validates_presence_of :user validates_presence_of :title diff --git a/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb b/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb new file mode 100644 index 000000000..11a9c7066 --- /dev/null +++ b/db/migrate/20131127105438_create_info_request_batch_public_bodies_join_table.rb @@ -0,0 +1,8 @@ +class CreateInfoRequestBatchPublicBodiesJoinTable < ActiveRecord::Migration + def change + create_table :info_request_batches_public_bodies, :id => false do |t| + t.integer :info_request_batch_id + t.integer :public_body_id + end + end +end |