I have the following code in a layout:
Posted <%=time_ago_in_words post.created_at %> ago
<% if post.has_tag != nil %>
in the <%= post.get_first_tag.name %> category
<% end %>
And the following code in the post model which is inheriting form
Tags is also inherited from ActiveRecord::Base and Post ‘has_many’
Firstly: Is this the best way of checking if the post object has at
least 1 associate tag attribute.
Secondly: Should I be putting this logic into a helper method?
Thirdly: Why doesn’t the following work (it returns a # where the tags
in the <%= post.tags.to_sentence %> category,
I guess its because tags aren’t actually stored as an array attribute,
but i don’t really know.