Subject
Message For most part, Rails can already display whatever is required from the Controller. It has the default CRUD pages as neat templates (this site uses the default template stylesheet). However, other than per-object CRUD.. our forum application has a more special 'show' function that shows not only the Post object. Without much ado, the following is the crucial snippet of the show.rhtml :
<h1><%= @post.send("subject") %></h1> <%= "<a href='mailto:#{@post.send("email")}'>" if @post.send("email") and @post.send("email") != "" %> <%= @post.send("author") %></a> <%= "| <a href='#{@post.send("url")}'>url</a>" if @post.send("url") and @post.send("url") != "" %> <br> on <%= @post.send("created_at") %> <p> <%= @post.send("message") %> <p> <% if @comments.length > 0 %> <table> <tr> <td width=20> </td> <td> <p><b>Comments (<%=@comments.length%>)</a></td> </tr> <% for entry in @comments %> <tr><td> </td> <td> <%= entry.send("message") %> <br><font style="font-size: 10px"> <%= "<a href='mailto:#{entry.send("email")}'>" if entry.send("email") and entry.send("email") != "" %> <%= entry.send("author") %></a> <%= "| <a href='#{entry.send("url")}'>url</a>" if entry.send("url") and entry.send("url") != "" %> <br>on <%= entry.send("created_at") %> [<%= link_to "Delete", :action => "destroy_comment", :id => entry.id %>] </font> <p> </td> </tr> <% end %> </table> <% end %>
Author
Email
Url
Created at 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 January February March April May June July August September October November December 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 — 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 : 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59