daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest May 23rd, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def update_tags
  2.     @story = Story.find(params[:id])
  3.     if params[:people_ids]
  4.       #debugger
  5.       to_remove = params[:people_ids].split(',') - @story.people.collect(&:id)
  6.       to_add = params[:people_ids].split(',') + @story.people.collect(&:id)
  7.       to_add.each do |id|
  8.         unless person_id.blank?
  9.           r = Relationship.new()
  10.           r.related_to_id = @story.id
  11.           r.related_to_type = 'Story'
  12.           r.relateable_id = id
  13.           r.relateable_type = 'Person'
  14.           r.save!
  15.         end
  16.       end
  17.       redirect_to :stories
  18.     end
  19.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top