Guest User

Untitled

a guest
Jan 22nd, 2018
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. ## post model
  2.  
  3. after_commit :share_all
  4.  
  5. def share_all
  6. user.share_content title, content
  7. end
  8.  
  9. ## user model
  10.  
  11. def share_content title, content
  12. # whatever stuff you have to determine whether it's a twitter and/or facebook update...
  13.  
  14. if go_for_twitter
  15. twitter.update title
  16. end
  17.  
  18. if go_for_facebook
  19. facebook.feed! :message => title
  20. # ...etc.
  21. end
  22. end
Add Comment
Please, Sign In to add comment