On Jan 27, 7:46 pm, Alpha Blue <[email protected]> wrote:
> I was just providing an example of how queries are formed.  Here's a
> quick and dirty test for you for the author find:
>
> def find_author(author)
>   require 'cgi'
>   cgi_author = CGI.escape(author)
>   q_author = cgi_author.gsub(/\+/, '+author:') + ' '
what does this line do? I know gsub will replace the +author text with
something that comes out from /\+/ (althought i don't know what this
regwxp could generate)

>   query = "http://www.google.com/groups?q=author:"; + q_author
what's with google groups? i only wanted to search websites. and while
testing it in irb, shouldn't it be
query = "http://www.google.com/groups?q="; + q_author ??

>   link_to(author, query)
> end
>
> then call that using <%= find_author("Author Name") %> in your views.

> Note that if you searched for author in the api you'll see that it only
> uses author in google groups and the format is generally
> author:first+author:middle+author:last etc... in the query output.
>
> In your example, since all you need is an author, you just need to make
> sure that the string for author is escaped correctly, not the entire
> URL.
>
> But, this should get you started.

much appreciate it!!
radu
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to