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.erb
file for the entity - The
link_to
reference to the object instances at theindex.html.erb
andedit.html.erb
files - The
redirect_to
calls on the update and create methods at the controller
Is 开发者_开发问答there anything else that I should remove?
You should:
- Remove the
show
action from the controller - Switch the
redirect_to
s increate
andupdate
to go to the new action - Remove the
link_to
s fromindex.html.erb
andedit.html.erb
- Remove the
app/views/entities/show.html.erb
- Stop the routes from being generated by changing the
resources :entities
line in your config/routes.rb file toresources :entities, :except => :show
You can/should remove:
- the show action in the controller
- the
show.html.erb
file - the route to the show action (in routes.rb)
- any links or redirects to the show action
精彩评论