Nested Attributes - Minus records from record set


/ Published in: Rails

Useful for building nested entries checkboxes etc


Copy this code and paste it in your HTML
  1. (Interest.all - user.interests).each do |interest|
  2. user.interest_users.build(:interest => interest)
  3. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.