So....let''s have a look if I understood the issue: -Find_all_by is actually the same like Find(:all), however Find_all_by is much shorter and less complicated than the syntax of Find(:all) -So in my CONTROLLER it says @files = find(:all) however I don''t want to see all files displayed in my selection box, because I only want to see the foles whose mandant_id is the same like the mandant_id in invoice. So i decided to change the @files = find(:all) into => *@files =File.find_all_by_mandant_id(Invoice.mandant_id)* But this doesn´t work so does any one has an inspiration to get it working?? If so please help me!! thnx a lot!! =D Valli --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Valerie, On Thu, 2009-07-16 at 12:30 +0200, Valerie Fehst wrote:> So....let''s have a look if I understood the issue: > > -Find_all_by is actually the same like Find(:all), however Find_all_by > is much shorter and less complicated than the syntax of Find(:all) > > -So in my CONTROLLER it says @files = find(:all) however I don''t want > to see all files displayed in my selection box, because I only want to > see the foles whose mandant_id is the same like the mandant_id in > invoice. > So i decided to change the @files = find(:all) into => > @files =File.find_all_by_mandant_id(Invoice.mandant_id)Invoice is a class. What you''re looking for is, I assume, the mandant_id of a *particular* invoice. So you need to use the mandant_id of that. Assuming you have grabbed that somewhere with another find like ... @my_invoice = Invoice.find(:first) then your find_by will look like... @files = File.find_all_by_mandant_id(@my_invoice.id) Note that using ''File'' as a model name is potentially problematic since File is also a ruby class. HTH, Bill