redirect_to, render -- Controller Questions

So I am just learning RoR and how I learn best is to come up with a problem and use another language to accomplish this. So I decided to do "Digg" type of site where people post a comment and people respond. So in my controller I have an action called

view_comments,

view_comments takes several parameters to view the page. params[:comment][:ptype_id], params[:user][:id]

While persisting a comment, I would like the user to be redirected back to view_comments. However I have tried to pass parameters to redirect_to and render and none have worked.

What would that look like?

      if @comment.save         flash[:notice] = 'Comment was successfully created. '         redirect_to :action => 'view_comments', ???       else         render :action => 'new'       end

Thank you in advance.

So I am just learning RoR and how I learn best is to come up with a problem and use another language to accomplish this. So I decided to do "Digg" type of site where people post a comment and people respond. So in my controller I have an action called

view_comments,

view_comments takes several parameters to view the page. params[:comment][:ptype_id], params[:user][:id]

While persisting a comment, I would like the user to be redirected back to view_comments. However I have tried to pass parameters to redirect_to and render and none have worked.

What would that look like?

      if @comment.save         flash[:notice] = 'Comment was successfully created. '         redirect_to :action => 'view_comments', ???       else         render :action => 'new'       end

Craig,     You suggestion doesn't quite work. It leaves me with errors like:

Couldn't find user without an ID

Request Parameters: {"user"=>"4", "comment"=>"ptype_id1"}

But now you have me wondering if I am missing the power of RoR when I have the form fields with names like

<input id="comment_ptype_id" name="comment[ptype_id]" type="hidden" value="1" /> <input id="u_id" name="user[id]" type="hidden" />

Then I get those values inside the controller like this params[:comment][:ptype_id]

I was just following the scaffolding that was already created by RoR.

Thanks

Hi