Hi guys, to give some background, I’m trying to add another column to the table schema of posts
table, I want to add another column which is meta_tag_id
. I got to a point where I can pass the data that I want to store in the parameters of PostController
, check the log below for reference(this is from the logs of d/rails s
):
Started POST "/posts" for 127.0.0.1 at 2022-09-16 06:08:19 +0000
Processing by PostsController#create as */*
Parameters: {"raw"=>"Another dummy reply, for testing purposes.", "unlist_topic"=>"false", "category"=>"5", "topic_id"=>"23", "is_warning"=>"false", "archetype"=>"regular", "typing_duration_msecs"=>"4500", "composer_open_duration_msecs"=>"11534", "featured_link"=>"", "shared_draft"=>"false", "draft_key"=>"topic_23", "meta_tag_id"=>"summary", "nested_post"=>"true"}
Now, what I want to achieve is to insert the meta_tag_id
parameter in another column of the posts
table, for reference, here is a sample logs of the SQL query when inserting a record in my posts
table:
Post Create (1.1ms) INSERT INTO "posts" ("user_id", "topic_id", "post_number", "raw", "cooked", "created_at", "updated_at", "sort_order", "last_editor_id", "last_version_at", "word_count", "baked_at", "baked_version") VALUES (1, 23, 7, 'Another dummy reply, for testing purposes.', '<p>Another dummy reply, for testing purposes.</p>', '2022-09-16 06:08:22.283658', '2022-09-16 06:08:22.283658', 7, 1, '2022-09-16 06:08:22.293786', 6, '2022-09-16 06:08:22.283601', 2) RETURNING "id"
I would be grateful if you guys could point me in the right direction. I’m not familiar with ruby, so I’m having a hard time finding the find that I should modify to achieve the adding of a new column and incorporating the meta_tag_id
variable to the values of the query. Thank you in advance guys!