How Would You Improve This Page?

On an application I’ve been working during my spare time, I had the need to ask my loyal friends and guinea pigs to give me some feedback, in order to help me fill in the gaps between what I think they want to do and what they really want to do in this application.

A quick, cheap and really useful solution I came up with was adding a feedback form right there, on every page the application renders. This can certainly be improved by people more knowledgeable in Rails than myself, as for now it doesn’t even use AJAX to post the data back (shame, shock and horror!)

After running scaffold_resource Comment body:text uri:string created_by:integer created_at:timestamp, you should be pretty much set to go. Now, on your application.rhtml, you can do something like:

<%= render :partial => "comment", :collection =>
Comment.find_all_by_uri(request.request_uri) %>

<% form_for :comment,, :url => comments_path do |f| %>
<%= f.hidden_field :uri, :value => request.request_uri %>
How would you improve this page?
<%= f.text_area :body, :rows => 5 %>
<%= submit_tag 'Add comment' %>
<% end %>

The _comment.rhtml partial is something like this:

<%= comment.body %>
Created by <%= if comment.created_by.nil? 'unknown' else link_to(, profile_url(comment.created_by.profile)) end %>

<%= time_ago_in_words comment.created_at %> ago

[<%= link_to 'Destroy', comment_path(, :method => :delete %>]

Customize the Comment controller slightly, and that’s it – instant feedback forms everywhere! :)