Guest User

Untitled

a guest
Jul 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. delete_heard_timeline_event(current_user.id, @showable_video.user.id, @showable_video.video.id)
  2.  
  3. def delete_heard_timeline_event(actor_id, subject_id, secondary_subject_id)
  4. TimelineEvent.find_by_actor_id_and_subject_id_and_secondary_subject_id_and_event_type(actor_id, subject_id, secondary_subject_id, 'heard_event').destroy
  5. end
  6.  
  7. a = YourModelName.new
  8. a.delete_heard_timeline_event(your_parameters)
  9.  
  10. YourModelName.delete_heard_timeline_event(your_parameters)
  11.  
  12. find_by_actor_id_and_subject_id_and_secondary_subject_id_and_event_type
  13.  
  14. class TimelineEvent
  15. def self.delete_heard_event(actor_id, subject_id, sec_id)
  16. self.scoped.where(:actor_id => actor_id,
  17. :subject_id => subject_id,
  18. :secondary_subject_id => sec_id,
  19. :event_type => 'heard_event').first.try(:destroy)
  20. end
  21. end
  22.  
  23. TimelineEvent.delete_heard_event(current_user.id, @showable_video.user.id, @showable_video.video.id)
Add Comment
Please, Sign In to add comment