In Rails, is it possible to use the show view as an edit view? -
In Rails, is it possible to use the show view as an edit view? -
new rails here, excuse me if simple. i'm having hard time finding out answer, want know before dive in deep.
the app i'm aiming build not have differentiation between 'show' view , 'edit' view. part, have listings of entries (index view) click straight through edit view. no 'show' view necessary.
it bulk of app. there still sections require 'show' views, though.
is possible set routing construction this?
if show view isn't necessary, can tell resource route in routes.rb
not include it, like:
resources :users, :except => :show
if want utilize same view both edit , show, in show
action, example, can like:
def show @user = user.find(params[:id]) render :action => 'edit' end
this utilize edit.html.erb
file when show action hit, although in sentiment best alternative pick view plan utilize , omit other in routes.rb
.
if want share lot of view code between 2 views, still differentiate them, create utilize of partials shared code.
ruby-on-rails model-view-controller
Comments
Post a Comment