Commit 5e8c09d4
Changed files (2)
app
models
views
creations
app/models/creation.rb
@@ -35,10 +35,16 @@ class Creation < ActiveRecord::Base
logger.error e.backtrace.inspect
end
end
+
def is_owned_by(user)
@user == user
end
+
def to_param
"#{id}-#{name.gsub(/[^a-z0-9]+/i, '-')}"
end
+
+ def has_comments
+ self.comment_threads.length > 0
+ end
end
app/views/creations/show.html.erb
@@ -91,6 +91,11 @@
<% end -%>
<h3>Comments <small><%= pluralize @creation.comment_threads.length, "comment" %></small></h3>
<hr />
+ <% unless(@creation.has_comments) -%>
+ <div class="alert alert-info">
+ Be the first to comment on this spectacular creation!
+ </div>
+ <% end -%>
<table class="table table-striped">
<% @creation.comment_threads.each do |comment| %>
<tr>