Ruby on Rails Monday, July 25, 2016

In my application I'm rendering comment part with each statement but
getting an unusual response in it. An empty comment is always been
there. I'm using Rails 4 with materialize css. This is how looks [1]
like.

Here is my code

<div class="s12 m7 l8 col">
<ul class="collection with-header">

<li class="collection-header">
<h5>Comment's for you</h5>
</li>

<% @student.comments.each do |comment| %>
<li class="collection-item">
<!-- Content in single row -->
<div>

<%= comment.content %>

<% if comment.user_id == current_user.id ||
current_user.try(:admin?) %>
<%= link_to [comment.student, comment], method: :delete, class:
"secondary-content" do %>
<i class="material-icons">delete</i>
<% end %>
<% end %>
</div>
</li>
<% end %>
</ul>
</div>


[1] : http://www.awesomescreenshot.com/image/1422159/fbabde9acca44d7813726991a087eb40


--
Cheers!

Deepak Kumar Sharma
Guru Nanak Dev Engineering College
India!

Blog: http://deekysharma.wordpress.com

--
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/CALDHwN5m4LndYwd2%3D8Zhn2GmAc0TnCZ%2BwS9s8OLMgzditVP8sg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment