Skip to content

Instantly share code, notes, and snippets.

@rociiu
Created April 15, 2010 12:27
Show Gist options
  • Save rociiu/367032 to your computer and use it in GitHub Desktop.
Save rociiu/367032 to your computer and use it in GitHub Desktop.
1: there is some hard code in the project like:
<% if false %>
Provided by <a href="http://recaptcha.net/" target="_blank">Recaptcha</a>
<% end %>
since the code wrap in the condition will never be execute, why not remove it .
2: maybe we can add fields into users for methods like "pending_count", so every time we load the information of user we don't need to join the friendships table.
3: we can move some big mail deliveries using background job (delayed_job etc.) , like InvitationMailer.deliver_invitations(@user, emails), since it will send couples of email out, it will lower the user experience to wait.
4: cleanup some jquery code, try to reduce replicated code. i.e for placeholder stuff , we can use a plugin for it (http://github.com/rociiu/jquery.placeholder)
5: i see :
before_filter :mailer_set_url_options
in the application_controlller why not put this code into the initializers , so it only execute in the boot process, if put it in the before_filters everytime it will be executed, that's unnecessary
6: route duplicated, like:
map.connect "sos/:city_name", :controller => :special_offers, :action => "index"
map.sos 'sos/:city_name', :controller => :special_offers, :action => "index"
7: users_controller#favorites, no need to use paginate for the @locations, @categories if we only need to find first categories/locations for the user
8: for the find conditions , we can use a hash for the value, i.e.
User.find(:all, :conditions => { ["first_name like :first_name", { :first_name => "%#{first_name}%"}]})
it will make the conditions more flexible, and no need to care about the order of the parameters
9:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment