From 0343220f8ece2f49b4b4e2a2fbffaedd67465f3e Mon Sep 17 00:00:00 2001 From: albert Date: Tue, 19 Feb 2013 13:50:30 -0500 Subject: [PATCH] fixes #404 --- app/models/upload.rb | 1 + app/views/uploads/new.html.erb | 5 +++++ db/migrate/20130219184743_add_parent_id_to_uploads.rb | 5 +++++ db/structure.sql | 7 +++++-- 4 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20130219184743_add_parent_id_to_uploads.rb diff --git a/app/models/upload.rb b/app/models/upload.rb index 63d9d66f3..52f138c47 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -99,6 +99,7 @@ class Upload < ActiveRecord::Base p.file_size = file_size p.uploader_id = uploader_id p.uploader_ip_addr = uploader_ip_addr + p.parent_id = parent_id unless uploader.is_contributor? p.is_pending = true diff --git a/app/views/uploads/new.html.erb b/app/views/uploads/new.html.erb index e412d516c..a8587b638 100644 --- a/app/views/uploads/new.html.erb +++ b/app/views/uploads/new.html.erb @@ -38,6 +38,11 @@ +
+ <%= f.label :parent_id, "Parent ID" %> + <%= f.text_field :parent_id %> +
+
<%= f.label :tag_string, "Tags" %> diff --git a/db/migrate/20130219184743_add_parent_id_to_uploads.rb b/db/migrate/20130219184743_add_parent_id_to_uploads.rb new file mode 100644 index 000000000..2ef6e1729 --- /dev/null +++ b/db/migrate/20130219184743_add_parent_id_to_uploads.rb @@ -0,0 +1,5 @@ +class AddParentIdToUploads < ActiveRecord::Migration + def change + add_column :uploads, :parent_id, :integer + end +end diff --git a/db/structure.sql b/db/structure.sql index 27274aadb..c32f20634 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2476,7 +2476,8 @@ CREATE TABLE uploads ( md5_confirmation character varying(255), created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, - server text + server text, + parent_id integer ); @@ -6177,4 +6178,6 @@ INSERT INTO schema_migrations (version) VALUES ('20130106210658'); INSERT INTO schema_migrations (version) VALUES ('20130114154400'); -INSERT INTO schema_migrations (version) VALUES ('20130219171111'); \ No newline at end of file +INSERT INTO schema_migrations (version) VALUES ('20130219171111'); + +INSERT INTO schema_migrations (version) VALUES ('20130219184743'); \ No newline at end of file