rails consoleからレコードを編集&レコードをループで追加
Hi ;) Haven’t seen you for a long while.
Today, I want to share my new knowledge with you as a rehab.
I’m not good at using rails console with terminal screen although my supervisor is telling me to use it.
That is a reason why I cannot go to the next level.
So my first step is to edit a record in db.
I did like this..
$ BlogComment.create(:blog_post_id => 110, :insta_user_id=> 4, :desc=> "test"+count.to_s)
it works!!
So let’s move on how to iterate comments for adding lots of records.
I use until
here.
$ count = 100 $ until count == 0 $ BlogComment.create(:blog_post_id => 110, :insta_user_id=> 4, :desc=> "test"+count.to_s) $ count -= 1 $ end
Now you could add 100 of records on your db!!
Isn’t that great?:)
See you!!