Saturday, 7 September 2013

Executing custom functions in Rails

Executing custom functions in Rails

I'm trying to integrate the socialization gem but I can't get over the
hump. The gem makes it super easy for models to follow and like one
another (e.g. dude.follow!(otherdude)). It adds the tables behind the
scenes. Works great in the console but I can't translate it into the MVC
model.
All I want is a "like" button/link that can lets users like a post
current_user.like!(post). The issue is that socialization does not create
a "Like" controller (nor the corresponding routes) that I can use to
create a "Like" instance. The like! method creates like instances and
manages the db on its own. How can I create a Like button and what do I
point it to?
My current approach is to consists of a custom controller method, routing
and etc. I'm not going to post it because it feels very wrong. Anyone have
any ideas?

No comments:

Post a Comment