I am making a joint party matching app.
In other words, it is a matching app for multiple people to multiple people.
I want to make a conditional branch so that my favorite users can chat with each other, but the conditional branch is too complicated to understand.
I will give you an overview of the app.
The models currently in use are the User model, the UserInfo model, and the RoomUser model.
The UserInfo model describes the information (area, number of people) posted by User.
You can post only one per user.
Other users can add the posted information to their favorites.
I want to be able to chat when each other likes each other's posts.
The problem this time is the conditional branch that "when each other likes each other's posts".
I don't understand here, and I'm worried about half a day. .. (;;)
class RoomsController
↑ Chat room controller.
I want to make a conditional branch in the new action here.
Column | Type | Options |
---|---|---|
user_id | string | null: false |
user_info_id | string | null: false |
- belongs_to: user
- belongs_to: user_info
user_id | user_info_id | |
---|---|---|
1 | 1 | 2 |
2 | 1 | Four |
3 | 2 | Four |
Four | Four | Five |
Five | 2 | 1 |
6 | 1 | 6 |
This is a simple representation of the state of Sequel Pro.
The leftmost column is the id.
The user_id column is the favorite user.
The user_info_id column is a favorite post.
Here, think that the number of user_info_id and the id of the user who posted it are the same.
class RoomsController
I wrote rooms_controller as above. ..
I thought it was wrong, so I'm not doing it.
Is there anyone who can do this conditional branching?
We look forward to hearing from you (; ∀ ;)
-
Answer # 1
Related articles
- ruby - [rails] regarding conditional branching of chat screens, etc
- ruby - about conditional branching with def index
- ruby on rails - about conditional branching using elsif
- ruby - i'm having trouble setting environment variables for activeadmin: access denied for user'root' @'localhost' (using passwo
- python 3x - i want to use starts with for conditional branching of if statements in python3
- ruby - i'm having trouble getting a bcrypt-encrypted password in rails
- ruby on rails - i'm having trouble solving the test error
- ruby on rails - rails conditional branch if there is ○○, it will be displayed if not, i want to divide this into a display
- typescript - i want to specify the type by conditional branching with the argument key
- ruby on rails - i'm having trouble installing rails
- ruby - rails json i don't know how to write json conditional branch that is returned when selected
- conditional branching in python
- ruby - i'm in trouble because of the error actioncontroller::urlgenerationerror in main#index
- ruby - i'm having trouble getting data out across tables
- ruby on rails - the same conditional expression is added in the where clause of the query after upgrading rails
- ruby - [rails] i'm having trouble with permission denied @ dir_s_mkdir -
- ruby - [rails] conditional branch of controller cannot be done
- ruby on rails - i want to display a list by branching with the value passed in params
- wordpress search-{$post_type} i want php to read css with conditional branching
- ruby - passing variables using render partial
- ruby - deployment error on heroku
- ruby - output the total integer value held by each user
- ruby - i want to use the search method for active hash data
- ruby - destroy action does not respond
- ruby - how do you see the rails controller relative path? (carrierwave directory deleted)
- ruby - when deploying on capistrano, i get the error "access denied for user'ec2-user' @'localhost' (using password: no)&qu
- javascript - run multiple times with js + each do
- how to reflect the layout downloaded from the external site in ruby on rails?
- ruby - how nice! function routes do not pass well (relation) [rails]
I can't answer ...
I think there is a smarter way, but I think you can get the expected value below as well.