我有困难的理解,请帮助我这个代码工作正确的海报,如果评论者评论的帖子,它显示了所有的用户评论,但我希望评论者看到他唯一的评论。隐藏所有注释
<% @post.comments.each do |comment| %>
<% next unless [comment.user, @post.user].include? current_user %>
all comment here
<%end%>
我找到了这个代码片段,它随机更改所有帖子的所有日期。(原文:将现有的发布日期更新为随机日期 )
-1, 'post_status' => 'any' ) );
foreach( $posts as $post ) {
//* Generate a random date between January 1st, 2015 and now
$random_date = mt_rand( strtotime( '1 January 2015' ), time() );
$date_format = 'Y-
据我所见,一段代码如下:
/ This is a comment that will never get displayed, even in the source code
永远不会被看到,所以似乎没有用?为什么一个人会用它
/! This is a comment that will only get displayed in the source code
当代码编译成HTML时,它会对代码进行注释。
有什么我没有得到的吗?为什么会有人做出无形的评论呢?
我有三节课
class Post
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :user, :inverse_of => nil
embeds_many :comments, :as => :commentable
field :content, :type => String
end
class Commment
include Mongoid::Document
include Mongoid::Timestamps
belongs_to :user, :inve
我已经使用D3成功地呈现了一个显示csv文件中数据的HTML表,但是当我将相同的代码移到meteor项目中时,我遇到了问题。传递给d3.csv()回调的数据对象一次选取一行HTML文件,而不是csv数据。仅当尝试在meteor中运行它时才会发生这种情况。
我的代码设置如下:
if (Meteor.isClient) {
d3.csv("data/dataset.csv", function(data) {
console.dir(data);
// do stuff
});
}
if (Meteor.isServer) {
// do other