Go rails caching!

I had no idea caching is SO simple in rails. I added some caching to thecollegestuff.com. Two places where caching was clearly needed were the college page listing all its professors and the professor page with all the ratings. Majority of the people who land on these pages are only viewing these pages. They are not really adding content. So, it makes sense to fetch the page quickly (from the cache). For now the way my cache expires is when someone rates a professor in which case I expire that professor page. Similarly, I expire the college page when a new professor is added. Below is a code snippet which does the caching. class ProfessorsController < ApplicationController caches_page :show cache_sweeper :professor_sweeper, :only => [ :create ] caches_page is self explanatory. I have cached the show transaction. cache_sweeper is used to expire the cache when a create method is called on the professor. Below is the sweeper code. class ProfessorSweeper < ActionController::Caching::Sweeper observe Professor def after_create(professor) expire_college_page(profesor.college_id) end private def expire_college_page(collegeId) expire_page :controller => "colleges", :action => "show", :id => collegeId end end That is all it takes to do a page caching! I am sure I can find more places in my code which can be cached. I will have to see if I can use some action caching or fragment caching somewhere. The home page has the top professor and college list which are database queries. I have to find a nice way to cache that part of the page. I will play around next weekend. Have a good week! Cheers, Mahesh

End of week 1 - thecollegestuff goes nowhere

It's been a week since I put thecollegestuff.com up. There has been one registered user apart from me (ouch!). I think there are many reasons for it. I am just brainstorming here for myself. Feel free to add anything I have left out.
  • the site is just ordinary. No killer features, nothing
  • Look and feel is very average
  • There is no much content there
  • I haven't done a good job of marketing the site
  • Let's see what I can do to fix each of them Point 1: I will work on adding the features in my todo list. Point 2: Anyone out there who can clean up the interface a little bit? Leave a comment if you are interested! Point 3: This is a chicken and egg problem. Users will be motivated if there is content. But they are the ones who will have to add content. So, I don't know what to do here. Point 4: I will start bugging my friends to use the site and spread the word and will look up online for some marketing techniques ;) That is the 3 point formula to win! I am sure I will laugh at myself looking back at this post sometime in the future. heh .. who cares. This is fun for now! The feelinig of starting a website is amazing even if it is crappy! That is all for now. Have a good week ahead! Cheers, Mahesh

    My first rails application is out!

    I have been learning rails for past few months.  You probably know it if you read my blog because there were a few things I posted as I learnt new things. I think the best way to learn is to build something. So, I built something finally! It is a dirty clone of ratemyprofessors.com and it is catered for colleges in India. And the name of the site is (roll the drums) thecollegestuff.com Yeah, I know. It is really simple with some very ordinary looks (there is a reason I do backend work for a living). But I feel good that atleast I have some product I can look at as a whole .  Anyway, I will work on my css skills and improve the look and feel.  I already have 20 more features lined up. The things I am more excited about are related to technologies and tools I want to try out like couchdb, memcached, some monitoring tools and so on. The whole idea of the site was for me to play with these things. If I get some users to my site, that will be a bonus! If you have any ideas, find bugs and so on feel free to let me know. I am totally excited about it! A big thanks to Naveen and Harini for all the help with the ideas and ironing out issues. Now, go ahead and play with the site and spread the word will ya? ;)