Named route js.erb

Hi,
I'm facing an issue with my js.erb files.
When I want to use some named routes inside my js.erb files (placed in
the asset/javascript folder) I get an error when I try to precompile the
files .ie:

undefined method `search_url' for #<Module:0x101df43bf>

How could I use my named route in my js.erb files?

Conf:
Rails 3.1.1