views:

417

answers:

1

If I render the update action from inside the create action, is there a way for the "update" view (i.e. update.html.erb) to know which action rendered it. I want the update view to print out the action name "create" when the create action renders it and print out the word "update" when the update action renders it. The problem is render seems to defer control to the invoked action so for all intents and purposes the update view always thinks it's coming from the update action.

class CtrlController < ApplicationController

  def create
    render(:action=>"update")
  end

  def read
  end

  def update
  end

  def delete
  end
+3  A: 

params[:action]

you may need to update your render line to

render :template => "ctrl/update"
John Douthat
Thanks !
drinks milk