views:

40

answers:

1

hello,

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 action to my second method.

class exemple
  def first
    ## sql save of params[:page] 
    render :action => "second"
  end

  def second
    ##
    ## Here I need my params[:page] to do paginate stuff
    ##
    respond_to do |format|
      format.html
    end
  end
end

So my question is : How can I send params with a render :action ?

thanks :)

+1  A: 
render :action => "second"

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

in your example when you render then your method secod is not get called but you are render to the views second.html.erb

for more details refer this

to call that method you have to use redirect_to something like following

redirect_to :action => "second", :page=> 4
Salil
thanks for your answer ! :)I tried with redirect_to and it's working but I would like to send ALL the GET params of the first method to the second.Do you know a solution or I have to send all the params one by one ?
Swann