diff --git a/app/models/bulk_update_request.rb b/app/models/bulk_update_request.rb index 9731b0fcd..2bc849ed5 100644 --- a/app/models/bulk_update_request.rb +++ b/app/models/bulk_update_request.rb @@ -1,5 +1,5 @@ class BulkUpdateRequest < ActiveRecord::Base - attr_accessor :title, :reason, :skip_secondary_validations + attr_accessor :reason, :skip_secondary_validations belongs_to :user belongs_to :forum_topic @@ -13,7 +13,7 @@ class BulkUpdateRequest < ActiveRecord::Base validate :script_formatted_correctly validate :forum_topic_id_not_invalid validate :validate_script, :on => :create - attr_accessible :user_id, :forum_topic_id, :script, :title, :reason, :skip_secondary_validations + attr_accessible :user_id, :forum_topic_id, :forum_post_id, :script, :title, :reason, :skip_secondary_validations attr_accessible :status, :approver_id, :as => [:admin] before_validation :initialize_attributes, :on => :create before_validation :normalize_text @@ -68,6 +68,7 @@ class BulkUpdateRequest < ActiveRecord::Base def create_forum_topic if forum_topic_id + forum_post = forum_topic.posts.create(body: reason_with_link) update_attributes(:forum_post_id => forum_post.id) else forum_topic = ForumTopic.create(:title => title, :category_id => 1, :original_post_attributes => {:body => reason_with_link}) diff --git a/db/migrate/20170413000209_add_title_to_bulk_update_requests.rb b/db/migrate/20170413000209_add_title_to_bulk_update_requests.rb new file mode 100644 index 000000000..39f57cd8c --- /dev/null +++ b/db/migrate/20170413000209_add_title_to_bulk_update_requests.rb @@ -0,0 +1,5 @@ +class AddTitleToBulkUpdateRequests < ActiveRecord::Migration + def change + add_column :bulk_update_requests, :title, :text + end +end diff --git a/db/structure.sql b/db/structure.sql index f0e67fe41..0e5fb9a45 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -892,7 +892,8 @@ CREATE TABLE bulk_update_requests ( created_at timestamp without time zone, updated_at timestamp without time zone, approver_id integer, - forum_post_id integer + forum_post_id integer, + title text ); @@ -7220,6 +7221,13 @@ CREATE UNIQUE INDEX index_wiki_pages_on_title ON wiki_pages USING btree (title); CREATE INDEX index_wiki_pages_on_title_pattern ON wiki_pages USING btree (title text_pattern_ops); +-- +-- Name: index_wiki_pages_on_updated_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_wiki_pages_on_updated_at ON wiki_pages USING btree (updated_at); + + -- -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: - -- @@ -7565,5 +7573,9 @@ INSERT INTO schema_migrations (version) VALUES ('20170316224630'); INSERT INTO schema_migrations (version) VALUES ('20170319000519'); +INSERT INTO schema_migrations (version) VALUES ('20170329185605'); + INSERT INTO schema_migrations (version) VALUES ('20170330230231'); +INSERT INTO schema_migrations (version) VALUES ('20170413000209'); +