Topic: modal dialog forms and will paginate

I want to make the edit and new forms in a basic crud application come up in a modal dialog box.

After the create or update methods have completed, normally without ajax, it would redirect to the index action however I would like it to close the dialog box and then update the index list via ajax. So I have put the whole index action (eg. @user = User.paginate :page => params[:page] ) into a function that I run once created or updated and then I update the index partial.

The problem I am having is with the pagination links within the index partial. They use the path of the update and create actions (eg. users/500 instead or just users) so when you try to click on the next page, they link to the wrong page.

Not sure if its more of a will paginate question. Whats the common pattern for updating the index page. Is it better to just to issue a Js redirect?