Displaying 20 results from an estimated 39 matches for "search_result".
2007 Apr 20
2
Running script does not return the correct page
...ser_agent_alias = ''Mac Safari''
page =
agent.get("http://www.sbstransit.com.sg/iris3/bus_serviceopt.aspx")
search_form = page.forms.with.name("Form1").first
search_form.txtsvcno = "014"
search_form.txtbusstop = ''92129''
search_results = agent.submit(search_form)
open(''output.html'',''w'') {|f| f.write search_results.body}
Thanks,
Peter
2006 Jul 21
1
Passing a variable between methods
...like ?)"] *
tokens.size).join(" and ") } order by s.created_on desc", *(tokens *
2).sort])
else
[]
end
end
end
Controller:
def search
@query = @params["query"]
@adverts = Advert.search(@query)
end
#Searches for Adverts
def search_results
@query = @params["query"]
@adverts = Advert.search(@query)
end
View:
search.rhtml:
<%= form_tag %>
<table>
<tr>
<td>Search:</td>
<td><%= text_field("advert", "query") %></td>
<td><input...
2008 Nov 03
2
Multiple Submit Buttons
...for working with forms looks just like this example.
require ''rubygems''
require ''mechanize''
a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = ''Mac Safari''
}
a.get(''http://google.com/'') do |page|
search_result = page.form_with(:name => ''f'') do |search|
search.q = ''Hello world''
end.submit
search_result.links.each do |link|
puts link.text
end
end
But now I have 2 <input type=submit.> values on my form. How can I tell
Mechan...
2006 May 02
1
Very simple RJS not working in IE
My HTML:
<div id="search_div" style="display: none;">
<table>
<tbody id=''search_results''>
</tbody>
</table>
</div>
My RJS:
page.insert_html :bottom, ''search_results'', "<tr><td>Test</td></tr>"
page.show "search_div"
Now, everytime this gets called, it adds a "Test" row. However, I...
2007 Apr 19
1
Do you have any idea what could be the problem with this script?
...ser_agent_alias = ''Mac Safari''
page =
agent.get("http://www.sbstransit.com.sg/iris3/bus_serviceopt.aspx")
search_form = page.forms.with.name("Form1").first
search_form.txtsvcno = "014"
search_form.txtbusstop = ''92129''
search_results = agent.submit(search_form)
open(''output.html'',''w'') {|f| f.write search_results.body}
Thanks,
Peter
2006 Jul 06
0
Ajax form results display help
...and cool effects.
Here is the operation that I would like
-User enters data
- On submit of the form, the spinner shows
- If there is an error, the error div is shown and everything else is hidden
- If results are successfully returned, spinner and error are hidden
and results are displayed in the search_results div with a :blind_down
effect.
Here is the view that I came up with:
<%= form_remote_tag(:html => {:action => :search}
:url => {:action => :list},
:update => {:success => ''search_results'', :failure => ''error''}
:before =>...
2006 Nov 04
0
form_remote_tag problems with post url
...the select tags), and below that, there are the
results which are updated in a results div. It essentially looks like the
following:
--------------------------------
search.rhtml -----------------------------------
<%= form_remote_tag(:update => ''search_results'', :url => {:action =>
:search}, :loading => ''SearchController.disableSearchForm()'', :complete => ''
SearchController.enableSearchForm()'', :id => ''search_form'')%>
<%= select(:search, :selection, [[''Newes...
2007 Jul 12
1
WWW::Mechanize::Link.inspect needs some TLC
...anize.new { |a| a.log = Logger.new("mech.log") }
agent.user_agent_alias = ''Mac Safari''
page = agent.get("http://www.google.com/")
search_form = page.forms.name("f").first
search_form.fields.name("q").value = "bratislava tournament"
search_results = agent.submit(search_form)
puts search_results.body
Given this ruby-debug session:
bugs $ rdebug mechanize01.rb
./mechanize01.rb:1 require ''rubygems''
(rdb:1) b 11
Set breakpoint 1 at mechanize01.rb:11
(rdb:1) c
Breakpoint 1 at mechanize01.rb:11
./mechanize01.rb:11 puts search_...
2012 May 28
1
rendering a partial inside another using render_to_string and (:formats) in controller
...|o, v| hash.merge(o => v) unless options.blank? }
hash
end
============================================================
WILL_PAGINATE PARTIAL:
============================================================
<div class="pagination_wrapper">
<%= will_paginate @search_result, :page_links => false,
:previous_label => "#{image_tag
''icons/control-180.png'', :class => "prev-button link-button link-
button-small"}",
:next_label => "#{image_tag '&...
2009 Jan 23
4
getValue() in a Controller problem, help please.
Hello there,
I''m trying to do something like:
render :update do |page|
page[:client_list].replace_html render(:partial => ''client_list'',
:object => @clients_list)
name = page[:name].getValue();
end
but I''m not getting the value, or somehow use $("name").getValue()
inside of the controller.
How can I do that?
tks,
David Sousa
--
2007 Oct 29
0
Ferret - sorting results by score
...m the results of a search, I use the ids to then look
up their corresponding records in the database. The reason for this is
that the database records contain more information than I am storing in
the index. Any ideas? Code example below. Thanks in advance!
def index
if (params[:q])
@search_results = Array.new
index = FerretConfig::INDEX
index.search_each(params[:q]) do |doc, score|
@search_results << index[doc][:id]
end
@quotes = Quote.find(@search_results)
end
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~--...
2007 Sep 27
2
Problem getting "extract" from RDig
...=> ''title'',
8. :content_tag_selector => ''body''
9. )
10. )
11.
12. end
I have created the index file using the code
1. rdig -c config/rdig_config.rb
Now in my controller I have written a code for testing the functionality
1. search_results = RDig.searcher.search("some_string")
2. @results = search_results[:list]
3. @hitcount = search_results[:hitcount]
My @result[:extract]is returning me the same initial view code that is
common to the application that is my menus and sub menus.. I am not
getting the extra...
2007 Aug 12
5
stubbing a method that yeilds sequential results
...e worked out how to stub things for the case where the Connector.
each_result method yields a result once
#setup
@result = mock("result")
Connector.stub!(:each_result).and_yield(@result)
@attributes = {}
@results = []
@block = Proc.new { |r| @results << r }
#action
Intermediate.search_results(@attributes, &@block)
# expectation
@results.should == [@search_result]
However, what I actually need to do is check each result that is
yielded by the Connector.each_result method and compare it to the
previous one. If they are sufficiently similar I need to merge them
(and same aga...
2009 Sep 17
1
Load Error Using Mechanize Gem
...Program -- main.rb:
----------------------
## Google
require ''rubygems''
require ''mechanize''
a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = ''Mac Safari''
}
a.get(''http://google.com/'') do |page|
search_result = page.form_with(:name => ''f'') do |search|
search.q = ''Hello world''
end.submit
search_result.links.each do |link|
puts link.text
end
end
----------------------
Resources I''m using:
Editor: Netbeans IDE 6.7.1
Gems install...
2006 Mar 21
2
Rails newbie can''t initialize a new Paginator object
Hi all,
I''m using ruby 1.8.2-15 and a recent rails 1.0 download.
I''m trying to implement the Classic/Custom pagination in a list action.
Here''s my code:
def list
getSearchTerms
# NOTE: @params[:search_results] is an Array of product_data objects
# returned by a search action.
@results = @params[:search_results]
if @results.nil? then
# The default list of all product_data
@product_datum_pages, @product_data = paginate :product_data,
:per_page => 10
else
page = (@para...
2006 Jul 17
2
IndexedSearchEngine Question
Good evening --
I''m really new to Rails and I was looking for a way to use
IndexedSearchEngine with a "get" call instead of the default "post". I
have the script by itself on a page /myapp/app/view/search/rhtml and I
want to be able to bookmark the query string.
I can''t seem to find where in the code the call to form_tag is. This is
as likely as not a
2006 Apr 08
0
Understanding observe_form...
...uttons, but it''s just the
first option and there are several more input fields in the form.
After my form, I have the observe_field tag:
<%= observe_form( ''advanced_search'',
:frequency => 1,
:with => "price",
:url => {:action => ''search_results''}) %>
After a lot of trial and error, I listed the "with" value as "price",
because for some reason it seemed be only the price value that was
passed. Whatever other options were in the form, whatever I listed
under "with" became an entry in my params...
2006 Jan 29
2
field sets and unicode
...:url => {:controller => ''article'', :action => ''search''},
:with => "''terms='' + escape(value)",
:update => ''search_results'',
:loading => "Element.show(''search_spinner'')",
:loaded => "Element.hide(''search_spinner'')"
%>
in my ar...
2012 Dec 19
0
(no subject)
...form = pagina.forms.first
campos = form.fields.find_all
titulo = pagina.title
form.field_with(:name => "username").value = "******" only informative
form.field_with(:name => "password").value = "******" only informative
search_results = m.submit form
@page = search_results.body
and display this:
Action Controller: Exception caught
OpenSSL::SSL::SSLError in AutoController#login
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
I?m new at this, help!
--
-----------...
2007 Dec 12
0
how can I use form_remote_tag to go to a different host ?
...confused a bit
I include all the default rails java script files and I change my form
by adding the rails-server part to look like this but it doesn''t work:
<form action="http://rails-server:3000/test/search" method="post"
onsubmit="new Ajax.Updater(''search_results'', ''http://rails-server:3000/
test/search'', {asynchronous:true, evalScripts:true,
parameters:Form.serialize(this)}); return false;">
Search <input id="searchtxt" name="searchtxt" type="text" value="" />
<input...