created a service to manage posts and fixed a bug in the ruby posts controller