Cheers,
I updated a project to 0.14.1 and have a problem with a ajax live search,
reverting to 0.13.1 solves the problem.
In the view:
<%= observe_field(:search,
:frequency => 1.5,
:update => :results,
:url => { :controller =>
''uni'',
:action => :ajax_suche,
:context
=>@request.request_uri },
:loading =>
"document.getElementById(''search-indicator'').style.visibility
= ''visible'';",
:complete =>
"document.getElementById(''search-indicator'').style.visibility
''hidden'';")%>
In the controller:
def ajax_suche
@query = request.raw_post || request.query_string
@context = params[:context].context
@profs = Prof.search(@query, @context)
render(:layout => false)
end
The problem is that search-team is appended with "&_=" and if I
type a "&"
into the search field, the action is not found (404 error).
The problem seems to be the value of request.raw_post.
Any hints?
Regards,
Jonathan
--
Jonathan Weiss
http://blog.innerewut.de
> I updated a project to 0.14.1 and have a problem with a ajax live search, > reverting to 0.13.1 solves the problem.I saw this today, too. I fixed it in my controller with a .chomp("%_=") In your case, change @profs = Prof.search(@query, @context) to @profs = Prof.search(@query.chomp("%_="), @context) -eric
>> I updated a project to 0.14.1 and have a problem with a ajax live search, >> reverting to 0.13.1 solves the problem. > > I saw this today, too. I fixed it in my controller with a .chomp("%_=") >I have to filter with .chomp("&_="). What happens if you append the search string with a "&"? Do you also get a 404? Regards, Jonathan -- Jonathan Weiss http://blog.innerewut.de
jonasb.12671723-opCBI309nnGakBO8gow8eQ@public.gmane.org
2005-Oct-25 15:00 UTC
Re: 0.14.1: Problem with ajax search
Hi, You might want to have a look at this: http://typo.leetsoft.com/trac/ticket/467 I don''t understand why this has changed though. Why is there a "_" in the request? /Jonas (jonas.b-7XRkppT4KCs@public.gmane.org) http://andthennothing.net --- rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org wrote: Cheers,> > I updated a project to 0.14.1 and have a problem witha ajax live search,> reverting to 0.13.1 solves the problem. > > In theview:> > <%= observe_field(:search, > :frequency=> 1.5,> :update => :results, >:url => { :controller => ''uni'',>:action => :ajax_suche,>:context> =>@request.request_uri }, >:loading =>> "document.getElementById(''search-indicator'').style.visibility= ''visible'';",> :complete => >"document.getElementById(''search-indicator'').style.visibility > ''hidden'';")%>> > In the controller: > > def ajax_suche > @query = request.raw_post|| request.query_string> @context = params[:context].context >@profs = Prof.search(@query, @context)> render(:layout => false) >end> > The problem is that search-team is appended with "&_=" and ifI type a "&"> into the search field, the action is not found (404 error).> > The problem seems to be the value of request.raw_post. > > Any hints?> > Regards, > Jonathan > > -- > Jonathan Weiss > http://blog.innerewut.de> > > > _______________________________________________ > Rails mailinglist> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails>
I decided to insulate myself somewhat against changes like this by
passing the stuff I needed in a named field. From my code:
<%= text_field_tag :image_search %>
<%= observe_field :image_search,
:frequency => 1.5,
:update => :image_search_results,
:url => {:action => :image_search },
:with => "''term='' + escape(value)" %>
Then, params[:term] contains the value I need.
I gleaned this off this list at some point: whoever it was, thanks :)
Mike
On 25 Oct 2005, at 16:00,
jonasb.12671723-opCBI309nnGakBO8gow8eQ@public.gmane.org wrote:
> Hi,
> You might want to have a look at this: http://typo.leetsoft.com/
> trac/ticket/467
>
>
> I don''t understand why this has changed though. Why is there a
"_"
> in the
> request?
>
> /Jonas (jonas.b-7XRkppT4KCs@public.gmane.org)
> http://andthennothing.net
>
> --- rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> wrote:
> Cheers,
>
>>
>> I updated a project to 0.14.1 and have a problem with
>>
> a ajax live search,
>
>> reverting to 0.13.1 solves the problem.
>>
>> In the
>>
> view:
>
>>
>> <%= observe_field(:search,
>> :frequency
>>
> => 1.5,
>
>> :update => :results,
>>
>>
> :url => { :controller =>
''uni'',
>
>>
>>
> :action => :ajax_suche,
>
>>
>>
> :context
>
>> =>@request.request_uri },
>>
>>
> :loading =>
>
>>
"document.getElementById(''search-indicator'').style.visibility
>>
> = ''visible'';",
>
>> :complete =>
>>
>>
>
"document.getElementById(''search-indicator'').style.visibility
>
>> ''hidden'';")%>
>>
>
>
>>
>> In the controller:
>>
>> def ajax_suche
>> @query = request.raw_post
>>
> || request.query_string
>
>> @context = params[:context].context
>>
>>
> @profs = Prof.search(@query, @context)
>
>> render(:layout => false)
>>
>>
> end
>
>>
>> The problem is that search-team is appended with "&_="
and if
>>
> I type a "&"
>
>> into the search field, the action is not found (404 error).
>>
>
>
>>
>> The problem seems to be the value of request.raw_post.
>>
>> Any hints?
>>
>
>
>>
>> Regards,
>> Jonathan
>>
>> --
>> Jonathan Weiss
>> http://blog.innerewut.de
>>
>
>
>>
>>
>>
>> _______________________________________________
>> Rails mailing
>>
> list
>
>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>
>
>>
>>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>