redirecting with params

def index     @posts = Post.search(params[:search], params[:page])               session.model.update_attribute(:viewing, "Home")   end

def save_requirement       @post = Post.new(params[:post])

        if @post.save           params[:search] = @post.title           redirect_to :action => :index         end

  end

the params[:search] from save_requirement doesn't make it through the redirect, why is this? What can I do to make it work?

Thanks!

def index    @posts = Post.search(params[:search], params[:page])              session.model.update_attribute(:viewing, "Home") end

def save_requirement      @post = Post.new(params[:post])

       if @post.save          params[:search] = @post.title          redirect_to :action => :index        end

end

the params[:search] from save_requirement doesn't make it through the redirect, why is this? What can I do to make it work?

You need to include what ever parameters you want after the redirect in the redirect.

redirect_to :action => :index, :search => params[:search]

this will fix it.

         if @post.save            params[:search] = @post.title            redirect_to :action => :index, :search => params[:search]         end

Use flash[:notice] = @post.title then in the view you can render the string contained in the flash.