hello all! I''m in deep shit for my exam tomorrow! :) as you can see, I want to search with Tesi.search with all params arriving from form ''se'' so I need to add the @tmp result to @tesis collection if not empty.. If I use an array for @tesis I can push @tmp but then I got errors in .rthml If I use @tesis = Tesi.new I can''t push (I don''t know how to..) but if I try to iterate @tmp in .rhtml it works... PLEASEEEE HELLPPP! :P my controller: def dosearch @search = "" @tesis = Tesi.new if (@params["se"]["free"].to_s.length > 0) @tmp = Tesi.search @params["se"]["free"].to_s @search << "<b>" << @params["se"]["free"].to_s << "</b> in Ricerca Libera " if(@tmp) @tesis << @tmp NOT WORKING end end if (@params["se"]["titolo"].to_s.length > 0) @tmp = Tesi.search @params["se"]["titolo"].to_s, :only => [''titolo''] @search << "<b>" << @params["se"]["titolo"].to_s << "</b> nel Titolo " if(@tmp) @tesis << @tmp NOT WORKING end end
Emanuele meK Tozzato
2006-Jun-28 10:41 UTC
[Rails] HELP! adding new object to @objects... {SOLVED}
as usual rails is the best :) solved with if (@params["se"]["titolo"].to_s.length > 0) @tmp = Tesi.search @params["se"]["titolo"].to_s, :only => [''titolo''] @search << "<b>" << @params["se"]["titolo"].to_s << "</b> nel Titolo " if(@tmp) for res in @tmp @tesis << res end end end YOU NEVER HELP ME! :* On Jun 28, 2006, at 12:21 PM, Emanuele meK Tozzato wrote:> I''m in deep shit for my exam tomorrow! :)