Skip to content

Instantly share code, notes, and snippets.

@bill-transue
Created February 7, 2013 20:35
Show Gist options
  • Save bill-transue/4733939 to your computer and use it in GitHub Desktop.
Save bill-transue/4733939 to your computer and use it in GitHub Desktop.
def collect_options_for_select(collection, selected=nil, &block)
options_for_select collection.collect { |member| block.call member }, selected
end
def elevations_for_sub_component_select(sub_component)
collect_options_for_select sub_component.component.send(sub_component.class.name.underscore.pluralize).find_all_by_model_id(sub_component.model_id), url_for do |sub_component|
if sub_component.is_a? SubComponentTemplate
[ sub_component.location, edit_admin_component_sub_component_path(sub_component.component, sub_component) ]
else
[ sub_component.location, edit_component_sub_component_path(sub_component.component, sub_component) ]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment