Removing the show method and all its dependencies

I have an existing entity created using forests. Now I understand that I really do not need to present the show view, and therefore I would like to eliminate any methods and fragments that are no longer needed. Besides the show method created on the object controller for me, what other parts should be removed? These are the ones I can think of:

  • show.html.erb file for an object
  • Link link_to object instances in index.html.erb and edit.html.erb
  • redirect_to invokes the update and creates methods on the controller

Is there anything else I should remove?

+4
source share
2 answers

You must:

  • Remove the show action from the controller
  • Switch redirect_to to create and update to go to the new action
  • Remove link_to from index.html.erb and edit.html.erb
  • Remove app/views/entities/show.html.erb
  • Stop creating routes by changing the resources :entities in the config / routes.rb file to resources :entities, :except => :show
+9
source

You can / must remove:

  • show action in the controller
  • show.html.erb file
  • route to show action (in routes.rb)
  • any links or redirects to the show action
+2
source

Source: https://habr.com/ru/post/1332153/


All Articles