2

レコードが作成されたら、ページが前のページに移動する瞬間にページを更新したい。ここに私のコントローラーからのコードがあります:

def create
@license = License.new(params[:license])

respond_to do |format|
  if @license.save
    format.html { redirect_to :controller => 'customers', :action => 'index' }
    format.json { render json: @customer, status: :created, location: @customer }
  else
    format.html { render action: "new" }
    format.json { render json: @customer.errors, status: :unprocessable_entity }
  end

end

redirect_to現在のIDを使用して、現在のページを更新するか、現在のページにリンクする必要があると書かれていますが、これは現在:controller => 'customers', :action => 'show'のページのレコードのIDになります。

4

2 に答える 2