Removing the show method and all of its dependencies
I have an existing entity that has been created by scaffolding. Now I'm realizing that I don't really need to present the show view and thus I'd like to eliminate any methods and pieces that are now unnecessary. Besides the show method created at the object controller for me, which other pieces should I remove? These are the ones I can think of:
- The
show.html.erbfile for the entity - The
link_toreference to the object instances at theindex.html.erbandedit.html.erbfiles - The
redirect_tocalls on the update and create methods at the controller
Is 开发者_开发问答there anything else that I should remove?
You should:
- Remove the
showaction from the controller - Switch the
redirect_tos increateandupdateto go to the new action - Remove the
link_tos fromindex.html.erbandedit.html.erb - Remove the
app/views/entities/show.html.erb - Stop the routes from being generated by changing the
resources :entitiesline in your config/routes.rb file toresources :entities, :except => :show
You can/should remove:
- the show action in the controller
- the
show.html.erbfile - the route to the show action (in routes.rb)
- any links or redirects to the show action
加载中,请稍侯......
精彩评论