ruby: drug_select_partials = Hash.new("default").tap do |h| h["Renalware::PD::PeritonitisEpisode"] = "peritonitis_episode" h["Renalware::PD::ExitSiteInfection"] = "exit_site_infection" end .document = simple_form_for prescription, url: url, html: { class: "prescription-form", autocomplete: "off" }, remote: true, wrapper: :horizontal_form do |f| = render "renalware/shared/errors", model: f.object .med-form.content id=("edit-meds-#{f.object.id}" ) = render "renalware/medications/prescriptions/drug_select/#{drug_select_partials[f.object.treatable_type]}_fields", f: f = hidden_field_tag :treatable_type, treatable.class.name = f.input :dose_amount, wrapper: :horizontal_small = f.input :dose_unit, wrapper: :horizontal_small = f.association :medication_route, collection: medication_routes, label_method: :code, prompt: :translate, wrapper: :horizontal_medium = f.input :route_description , wrapper: :horizontal_medium = f.input :frequency, wrapper: :horizontal_small = f.input :administer_on_hd, wrapper: :horizontal_small = f.input :notes, wrapper: :horizontal_medium = f.input :prescribed_on, as: :date_picker, wrapper: :horizontal_datepicker - if f.object.new_record? = f.simple_fields_for(:termination) do |tf| = tf.input :terminated_on, as: :date_picker, required: false, wrapper: :horizontal_datepicker = f.input :provider, collection: provider_codes, as: :inline_radio_buttons, label_method: :to_label, wrapper: :horizontal_medium = f.input :last_delivery_date, as: :date_picker, wrapper: :horizontal_datepicker .row.actions .small-9.columns = f.button :submit, "Save" span= " or " = link_to "cancel", patient_prescriptions_path(patient, treatable), remote: true