Skip to content

Instantly share code, notes, and snippets.

@neudabei
Created August 10, 2018 08:43
Show Gist options
  • Save neudabei/9cf3efeb343bcdb7967aa51f2b83671a to your computer and use it in GitHub Desktop.
Save neudabei/9cf3efeb343bcdb7967aa51f2b83671a to your computer and use it in GitHub Desktop.
fl_medium_blogpost
def subject_category_interest_props
subject_categories = SubjectCategory.in_alphabetical_order
interested_subject_categories = current_user.interested_subject_categories
{ fields:
subject_categories.map do |sc|
selected = interested_subject_categories.include?(sc)
{ title: sc.title, value: sc.id.to_s, selected: selected }
end }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment