HELP! adding new object to @objects

hello all!

I’m in deep shit for my exam tomorrow! :slight_smile:

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! :stuck_out_tongue:

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 << “” << @params[“se”][“free”].to_s << " 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 << “” << @params[“se”][“titolo”].to_s << " nel
Titolo "
if(@tmp)
@tesis << @tmp NOT WORKING
end
end

as usual rails is the best :slight_smile:

solved with

if (@params[“se”][“titolo”].to_s.length > 0)
@tmp = Tesi.search @params[“se”][“titolo”].to_s, :only =>
[‘titolo’]
@search << “” << @params[“se”][“titolo”].to_s << " nel
Titolo "
if(@tmp)
for res in @tmp
@tesis << res
end
end
end

YOU NEVER HELP ME!  :*