Hi, this is my second post ( sorry for my language ) need yours helps with my problem. i need filter my model by an option in a Combo select i thing, "i should be" with observe_field and render partial, but i have a problem, when past to the second page, the application give me an error. about ID thx for your helps! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David, Could you post the code that you are using as well as the error message that it''s returning? David navarrete David wrote:> Hi, this is my second post ( sorry for my language ) > > need yours helps with my problem. > i need filter my model by an option in a Combo select > > i thing, "i should be" with observe_field and render partial, but i have > a problem, when past to the second page, the application give me an > error. about ID > > thx for your helps!-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
*** controller **
def filtro
if !params[:filtro][:campo].nil?
tipo_filtro = params[:filtro][:campo]
@inmobiliaria = Inmobiliaria.find(params[:id])
proyecto = @inmobiliaria.proyectos_inmobiliarios.find(:all,
:conditions => [''tipo_propiedad_id = ?'',tipo_filtro])
end
@proyectos = proyecto.paginate :page => params[:page], :per_page =>
10
@numero_proyectos = proyecto.size
render :partial => "resultado_inmobiliaria", :layout =>
false,
:object => @proyectos
end
****
*** show **
<% form_for ''filtro'', :url => {:action => :filtro,
:id => params[:id]}
do |f| %>
<%= f.select :campo,
@tipos_propiedades.collect {|p| [ p.descripcion, p.id ] },{
:prompt => ''Seleccione Filtro''}, {:onchange =>
"submit();"} %>
<%= f.submit "asd"%>
<% end %>
<div id="inmobiliaria">
<%= render :action => "resultado_inmobiliaria" %>
</div>
** show **
thx
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
ups the error You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occurred while evaluating nil.[] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
try: if params[:filtro] && !params[:filtro][:campo].nil? ... or if (params[:filtro][:campo] rescue false) if there''s no params[:filtro], the chained call to [:campo] will cause that error. On Aug 27, 5:48 pm, David navarrete David <rails-mailing-l...@andreas- s.net> wrote:> ups the error > > You have a nil object when you didn''t expect it! > You might have expected an instance of ActiveRecord::Base. > The error occurred while evaluating nil.[] > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Reasonably Related Threads
- Warning message in summary of PGLM
- Estimada comunidad, queria pedirles ayuda porque realmente llevo muchas horas tratando de hacer algo que debe ser simple, y por eso mismo ya me esta frustrando ...
- Consulta sobre mensaje de error al aplicar un Filtro.
- remover y reemplazar
- Filtrar columnas a partir de una lista