Last active
August 29, 2015 14:08
-
-
Save vluzrmos/18ad0329cf54a3a361a2 to your computer and use it in GitHub Desktop.
Customizando o select do Tora
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
tipo_ocor = { | |
:association => f.object.class.reflect_on_association(:tipo_ocorrencia), | |
:options => {:include_blank => true}, | |
:html_options => { | |
:onchange => remote_function(:url => { | |
:controller => "advocacia/processos", | |
:action => "campos_tipo_ocorrencia", | |
:index => index | |
}, | |
:with => "'id=' + escape($('processo_ocorrencias_#{index}_tipo_ocorrencia_id').value)" )} | |
} | |
%> | |
<%= f.select(tipo_ocor[:association].primary_key_name, | |
TipoOcorrencia.find(:all, :conditions => "ativo is true or ((ativo is false or ativo is null) and id='#{f.object.try(:tipo_ocorrencia_id)}')").collect {|p| [ p.send('tipo'), p.id ] }, | |
tipo_ocor[:options], | |
tipo_ocor[:html_options]) | |
%> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment