Ruby on Rails Monday, June 26, 2017



On Wednesday, June 21, 2017 at 8:34:17 AM UTC-4, Walter Lee Davis wrote:

> On Jun 21, 2017, at 3:52 AM, fugee ohu <fuge...@gmail.com> wrote:
>
> How do I give new.js.erb the right element name
>    $('#comment_post)click.(function(){
> In this line there's no id number

I think you may have missed a few bits of my reply. We are not observing a click any more. Everything is out of the jQuery pool, and fully into the RJS pool. If you're viewing this in the Google Groups (Web) view, you may need to expand all of the little ... ellipses in order to see all of my threaded replies.

in the second content_tag_for statement collection: post.comments fails to produce anthing for comment.body when the _comment.html.erb partial is rendered

_post.erb.html

 <%= content_tag_for(:div, post) do %>
    <%= simple_format post.content %>
    <% unless post.attachment.blank? %>
      <%= image_tag(post.attachment, height: 250) %><br>
    <% end %>
    <%= content_tag_for(:div, post, 'comments') do %>
        <%= render '/comments/comment', collection: post.comments %>
        <%= content_tag_for(:div, post, 'comment_form_holder') do %>
            <%= link_to 'Comment', new_comment_path('comment[commentable_id]': post.id, 'comment[commentable_type]': 'Post') %><br><br>
        <% end %>
    <% end %>
<% end %>


_comment.html.erb

<%= content_tag_for(:div, @comments) do %>
    <%= simple_format comment.body %>
    <%= comment.post.user.first_name comment.post.user.last_name %>
<% end %>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ed82e3fd-acfe-4cfd-8ccf-f2fd95c2f76a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment