[Ruby] I tried to make an application that allows you to post and chat by genre

2 minute read

I posted an overview of the app in the previous article. From here, I would like to make an article about the difficulties when creating the application.

:star: Generally starts from the genre page

  1. First, select the genre of this app, or create your own
  2. Select a genre to open the genre page
  3. You can post on the right side of the genre page, and you can search chat groups in the genre on the left side.
    That is, you need genru_id for most page transitions and data transmission
    **This means that most things are tied to (within) a genre as a parent **
    Personal application for Qiita.png

This was disturbed in various ways.
I searched for various methods, but sometimes there was something that could be easily done with that page alone, but it would not work if there were genre pages in between.
At first I thought why it didn’t work, but I was missing genru_id (laughs).

:star: There were many intermediate tables

Please check the ER diagram below.

:sunny: Database (ER diagram)

Untitled Diagram (1)

  • How many intermediate tables are there?
    A => 3 (UserGenrus table/UsersGroups table/Likes table)

Actually, I tried to create another intermediate table (hope table), but since the shape was the same as the UsersGroup table, the hope table is storing records using integer. So there are actually four.
In particular, it was hard to store group member ids in the UsersGroups table (laughs) Also, it was difficult to create the intermediate table in a slightly wrong way. I will write another article about this area.

:star: Like feature did not become JS

Speaking of the results, it became JS (laugh) But at first, I didn’t make it into JS, and I said “Why~!”

  • Why JS was made
    => JS Conversion If you put it on hold for the time being and proceeded with another function, there was a hint there!

:star: Image preview of posting function (by JS)

Before posting, I made a preview so that you can check if the image is correct, but this is a songwriter… When I thought I could make it into a preview, I struggled quite a bit because the upper limit on the number of sheets did not work well (laugh)

:star2: Impressions

For now, is it something like this that you have been struggling with? I really wanted to go into detail about where I struggled, but I will change it and write each function as an article