@radhames thanks but in create.js.erb I do not want comments, just the
@comment that was just created via a AJAX post with the comment
controller's create...

I'm using your comments code example in the link you listed, it's
great :)

But your example in create.js.erb sends back ALL the comments for a
model, I just want to return the comment that was just created. Can
you show me how to do that in your example? What should craete.js.eb
look like?

Thanks


On Sep 27, 5:45 am, radhames brito <[email protected]> wrote:
> @sunny @comment does not exists inside the create action, and he needs to
> iterate over a collection , @comments
>
> <%=escape_javascript(render :partial =>"comments/comment", :locals =>
> {:comments =>fill the comments collection...))%>
>
> or
>
> @comment =  lots of stuff going on here but it works...
> @comments = fill the comments collection..
>        if @comment.save
>          flash[:notice] = "Successfully created comment."
>          respond_to do |format|
>           format.js
>        end
>      end
>
> then
>
> <%=escape_javascript(render :partial =>"comments/comment", :locals =>
> {:comments => @comments))%>
>
> @comments does not exists inside the response from create.js.erb so you have
> to build it there or in the controller's create action before the respond_to
> block
>
> you can check my example
>
> http://github.com/rbritom/Simple_polymorphic_nested_comments

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to