lastomato/mongoid_followable — Issue #2: Pointing to follow method within link_to or button_to?
Author: ferrettim
Created: 2012-01-19 01:18:30+00:00
State: open

How would you use @someuser.follow(@anotheruser) within a link_to or button_to tag? I've tried several different methods and am currently just calling it from within link_to as <%= link_to "Follow", someuser.follow(anotheruser) %> but of course, the function is called whenever the page is loaded AND when the link is clicked. This is fine on pages only calling the function once, but in others (say a user directory), it just reverses the follow/unfollow whenever the page is load.

Ideas?