Skip to content

Instantly share code, notes, and snippets.

@kwstannard
Last active December 27, 2015 11:48
Show Gist options
  • Save kwstannard/7320767 to your computer and use it in GitHub Desktop.
Save kwstannard/7320767 to your computer and use it in GitHub Desktop.

old view

<%= select_for_tag :name,
  options_for_select(complex.stuff.collect{|d| d.stuff} + ['other', 'stuff']) %>

new view

<%= select_for_tag :name,
  options_for_select(complex.stuff.collect{|d| d.stuff} + admin_selection_choices(user) + ['other', 'stuff']) %>

helper method

def admin_selection_choices(user)
  if user.admin
    ['admin', 'choices']
  else
    []
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment