开发者

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 the index.html.erb and edit.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_tos in create and update to go to the new action
  • Remove the link_tos from index.html.erb and edit.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 to resources :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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜