<% if @registro.nil? %> <% return %> <% end %> <%= simple_form_for @registro, url: modelo_path(@registro), defaults: { input_html: { class: 'span10' } } do |f| %> <%= render partial: 'msip/hogar/errores', locals: { f: f } %> <% @atributos_form.each do |atr| %> <% clase = @registro.class.to_s %> <% alf = @registro.class.asociacion_llave_foranea(atr) %> <% vatr = atr.to_s.gsub(/[^a-z_A-Z0-9]/, '') %> <% rutavatr = clase.pluralize.underscore + "/campo_#{vatr}" %> <% (ri, rm, rd)=clase.pluralize.underscore.rpartition("/") %> <% radmin = "#{ri}/admin/#{rd}/campo_#{vatr}" %> <% if lookup_context.find_all(rutavatr, [], true).any? %> <% # Hay un parcial especifico %> <%= render partial: rutavatr, locals: {f: f} %> <% elsif lookup_context.find_all(radmin, [], true).any? %> <% # Hay un parcial especifico %> <%= render partial: radmin, locals: {f: f} %> <% elsif lookup_context.find_all("msip/modelos/#{vatr}", [], true).any? %> <% # Hay un parcial generico %> <%= render partial: "msip/modelos/#{vatr}", locals: {f: f} %> <% elsif lookup_context.find_all("msip/modelos/campo_#{vatr}", [], true).any? %> <% # Hay un parcial generico %> <%= render partial: "msip/modelos/campo_#{vatr}", locals: {f: f} %> <%else # Se genera el campo automaticamente %> <%= render partial: 'msip_campo_aut', locals: {f: f, atr: atr} %> <% end %> <% end %> <% end %>