You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Both of these methods are quite long (44 lines for add and 54 lines for the remove) it makes the methods difficult to read. rubocop has a default method length of 10 lines more information about this cop here
A good plan of attack for this issue would be the following:
Ensure that the tests for these two methods are complete and have full coverage
1a. Tests can be found in the project directory structure at /spec/controllers/allies_controller_spec.rb
Begin extracting methods out from the two methods. Try to keep the new methods at about 10 lines in length.
2a. Anywhere you see duplication or queries are good for extracting into separate methods
2b. Extracted methods can be placed inside models, controllers, or new Ruby objects entirely
Rename variables capture query results that are being rerun (if possible)
The text was updated successfully, but these errors were encountered:
andrew-schutt
changed the title
Refactor the add and remove methods in allies_controller.rb
Refactor the add and remove methods in allies_controller.rb
May 19, 2017
Both of these methods are quite long (44 lines for
add
and 54 lines for theremove
) it makes the methods difficult to read.rubocop
has a default method length of 10 lines more information about this cop hereA good plan of attack for this issue would be the following:
1a. Tests can be found in the project directory structure at
/spec/controllers/allies_controller_spec.rb
2a. Anywhere you see duplication or queries are good for extracting into separate methods
2b. Extracted methods can be placed inside models, controllers, or new Ruby objects entirely
relevant RailsCast episode
The text was updated successfully, but these errors were encountered: