render :action with params

前端 未结 1 1409
不思量自难忘°
不思量自难忘° 2021-02-18 22:53

I have one Class with 2 methods. The first method is called by the view with some GET parameters ( params[:page] ). I would like to save those params and send them by a render a

相关标签:
1条回答
  • 2021-02-18 23:17
    render :action => "second"
    

    When you render, then your method written in :action is not called, only the view with that action name is called.

    In your example, when you render, then your method second is not called but you are instead rendering the second.html.erb view.

    For more details refer to this.

    To call that method you have to use redirect_to, which looks something like the following:

    redirect_to :action => "second", :page=> 4
    
    0 讨论(0)
提交回复
热议问题