While installing Rubocop and solving the error, the following error came out quite a lot. 「Use 2 (not 1) spaces for indentation.」
Even if I looked it up, there were few commentary articles in Japanese, so I will leave it as a memorandum. If you have any mistakes, please let us know.
By the way, the automatic correction of Rubocop did not work \ (^ o ^) /
MacOS Catalina Rails 6.0.3.2 Ruby 2.6.3
When I try Google Translate, it looks like the following. "Use two (rather than one) spaces for indentation." In other words, do you mean to leave two indents?
app/controllers/messages_controller.rb:2:1: C: Use 2 (not 1) spaces for indentation.
before_action :set_room, only: [:create, :destroy]
^
app/controllers/messages_controller.rb:6:2: C: Use 2 (not 1) spaces for indentation.
if Entry.where(user_id: current_user.id, room_id: @room.id)
^
app/controllers/messages_controller.rb:7:3: C: Use 2 (not 1) spaces for indentation.
@message = Message.create(message_params)
^
It doesn't look like a problem at first glance, but if you say that there is one space available, it's empty. There are other similar lines, though. .. ..
For example, in the line below, only the line above is angry for some reason.
before_action :set_room, only: [:create, :destroy]
before_action :set_message, only: [:destroy]
Mystery of mystery.
before
before_action :set_room, only: [:create, :destroy]
after
before_action :set_room, only: [:create, :destroy]
When I fixed it, the number of errors decreased ... It feels strange, but is this something wrong? ?? As a result of returning to the original → Error is further reduced (laugh)
However, it seems that the number of errors has decreased, not the corresponding line, but another error. Well, I don't know why it decreased, so what's the correct answer? .. ..
If you look closely, all the errors are in the same file, so Expected to have some problems specific to this file.
The bottom line is, "Only the file with the error was indented on the tab." By changing to space indent in VSCODE, the error disappeared. I don't know why this file was different ...
It was an ordinary mistake, but I couldn't get to life because of the error message. I hope it helps those who are similarly troubled!