Concerns is a tool I'm pretty sure I won't use in the future. Are there any reservations as to deleting these completely from controllers
/models
folders?
Asked
Active
Viewed 68 times
0

sawa
- 165,429
- 45
- 277
- 381

sloneorzeszki
- 1,274
- 3
- 12
- 22
-
2No, go ahead and delete. – Marek Lipka Mar 18 '19 at 08:09
-
@MarekLipka what is the concerns directory used for? – BenKoshy Mar 18 '19 at 08:54
-
2@BKSpurgeon Concerns are basically modules, but with some convenience methods. See [here](https://stackoverflow.com/a/46686519/4000293). – sloneorzeszki Mar 18 '19 at 09:11
1 Answers
1
Very often, concerns are used to reduce the size of a class. This is even more common in projects using tools such as Rubocop in their CI process. In those situations, when a file exceeds a particular threshold, the quickest solution is to extract a concern. The logic is moved elsewhere and the number of lines of that class is reduced.
So, It's not mandatory to have concerns in your app. you can include them or not as per your code needs.

Vishal
- 818
- 8
- 20
-
Thanks. I know what they are used for, just didn't know if anything in Rails internally requires them even if unused. FYI extracting code just for the sake of making the file smaller is just hiding complexity. In my book it doesn't solve any problems, just makes them harder to see. – sloneorzeszki Mar 18 '19 at 09:34