Topic: Building a Rails app without Show actions?

I was just wondering if anybody has ever built a Rails application without any Show actions.

In my application, if a user picks, say a Project, from the list he will probably want to not just show it but also edit it.

So is it good practice to not implement any show actions and instead link all records to edit forms?

The only caveat I see is that a user might accidentally edit a project. But this could be prevented by setting a default attribute "disabled" on all form fields using jQuery. That way, a user will have to click a button "Edit" in order to unlock the form fields for editing.

Does that make sense or am I completely nuts?

Who knows, maybe this causes conflicts with Rails' RESTful architecture?

Re: Building a Rails app without Show actions?

You can enable/disable actions by editing your routes ('routes.rb' file).
For example to disable 'show' method in ProjectsController, just put it as follows:

resources :projects, only: [:new, :create, :edit, :destroy]

It supposes that you use RESTful routes for project resources.
See more on Rails routes at Rails Guides.

Last edited by Javix (2012-10-09 03:06:58)