Displaying 1 result from an estimated 1 matches for "related_entri".
Did you mean:
related_entries
2006 Mar 13
5
Displaying related entries by tags - HELP!
...uot;) %>
<p><%= post.entry %></p>
<% end %>
#layout
<% for related in @contents_related %>
<li><%= related.title %><br /></li>
<% end %>
#controller (how do I pass the tag_id and the content_id?)
@contents_related = Content.show_related_entries(?,?)
#model
def self.show_related_entries(t_id, c_id)
find_by_sql("select c.title from contents c inner join contents_tags
ct on c.id = ct.content_id where ct.tag_id = #{t_id} and c.id !=
#{c_id}")
end
The function works if I manually pass a content_id (for my entry) and a
ta...