I used “rails generate scaffold …” to build my model, views and
controllers. However for this particular MVC I don’t want to have a show
template. So, I removed the show method from the controller. But, show
still appears. Why is this. Does ApplicationController have a show
method?
Is the only means to do this by deleting the show template? thanks
On Sat, Feb 1, 2014 at 5:18 PM, Bizt [email protected] wrote:
I used “rails generate scaffold …” to build my model, views and
controllers. However for this particular MVC I don’t want to have a show
template. So, I removed the show method from the controller. But, show still
appears. Why is this.
What does rake routes
tell you? Compare that to config/routes.rb.
–
Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan
Yes, it must be in routes. I forgot. In config/routes.rb it seems to be
handle with:
resources :accounts
In the documentation it seems I can specify which methods I want to
allow:
resources :accounts, only: [:index, :new, :create, :edit, :update,
:destroy]# no show
is this the correct/ best way to restrict access? Then I can delete my
controller method ad view(?)
On Sat, Feb 1, 2014 at 6:30 PM, Bizt [email protected] wrote:
In the documentation it seems I can specify which methods I want to allow:
resources :accounts, only: [:index, :new, :create, :edit, :update, :destroy]
no show
is this the correct/ best way to restrict access?
You can also use
resources :accounts, except: [ :show ]
Then I can delete my controller method ad view(?)
Sure. Or maybe. Do frequent git saves, try it, change your mind,
it’s all good
–
Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan
Hey guys, I just read why this is happening at The Rails 4 Way book:
“The goal of the typical controller action is to render a view
template—that is, to fill out the template and hand the results, usually
an
HTML document, back to the server for delivery to the client. Oddly—at
least it might strike you as a bit odd, though not illogical—you don’t
actually need to define a controller action, as long as you’ve got a
template that matches the action name.”
So, try to delete the ‘show’ template for this controller and try again.