Monday, September 6, 2010

[Rails] Re: Cannot seem to display Comments on User Show Page

PsiPro wrote:
> It would help to know the URL your being redirected to... but I see
> one potential issue:
>
> if @comment.save
> flash[:success] = "Comment saved."
> redirect_to articles_path(@article)
> else
> render 'show'
> end
>
> Lets pretened your comment failed to save... your rendering show...
> Show what? By default your going to render the comment#show action
> with no ID. You want to be rendering articles/show i assume.

Oops, I forgot to mention that I made some changes to the code in the
above posts. That's correct, though. I had to change it to
articles/show.
I still cannot figure out this problem:
My edit link(when using goes to:
http://localhost:3000/articles/320/comments/297/edit, when it should go
to http://localhost:3000/articles/297/comments/320/edit.

Is there a problem with my articles show page:
def show
@article = Article.find(params[:id])
@comments = @article.comments.paginate(:page => params[:page])
@comment = Comment.new
@title = @article.title
end

Maybe some confusion with the IDs?
--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate