Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def update_tags
- @story = Story.find(params[:id])
- if params[:people_ids]
- #debugger
- to_remove = params[:people_ids].split(',') - @story.people.collect(&:id)
- to_add = params[:people_ids].split(',') + @story.people.collect(&:id)
- to_add.each do |id|
- unless person_id.blank?
- r = Relationship.new()
- r.related_to_id = @story.id
- r.related_to_type = 'Story'
- r.relateable_id = id
- r.relateable_type = 'Person'
- r.save!
- end
- end
- redirect_to :stories
- end
- end
Add Comment
Please, Sign In to add comment