i don't know where to begin in thanking you for all the time and skill
that you put into my problem, and for explaining the problem step by
step, just like someone should for a noob.
I;ll keep in mind every tip u gave me and try tsome day to undestand
the thing with the classes and the helpers for queries and become a
query search googel exper.
Until then there is a lot of work for me, but i know i can rely on my
friends here, on RoR Talk.

all my best,
radu

p.s i know a lot of programmers and us noob programmers love a gooed
rock song, so care for Mark Knopfler? :)
i know i do
so this is a small gift for helping a fellowpRoR programmer still in
noob form :)

http://www.youtube.com/watch?v=F1-uOIKJLvg

On Jan 27, 10:38 pm, Alpha Blue <li...@ruby-forum.com> wrote:
> >> 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)
>
> gsub is used for substitution.  Unlike sub which only substitutes the
> first regexp match found, gsub substitutes any number of matches found.
>
> The /\+/ is looking for anything that has a + symbol.  So, My+Name+Is
> etc.  When you use the cgi method above on the author name, it will
> correctly escape the html, which is necessary because an author's name
> could be anything from First Middle Last to First M. Last etc.
>
> Once the cgi method correctly formats the author's name, you are just
> providing a bit of substitution for Google's query engine.  It's going
> to replace the + between the author's name with '+author:' and then add
> a space after the entire string so that if you had a name like John+Doe,
> it would appear as:
>
> John+author:Doe
>
> The query then appends this string:
>
> query = "http://www.google.com/groups?q=author:"; + q_author
>
> .. to this ..
>
> to form..
>
> http://www.google.com/groups?q=author:John+author:Doe
>
> And if you click the link for this above, you'll see what happens when
> you get to google.
>
> Like I mentioned, you can tidy it up a bit if you want or keep it as
> needed.  It will work.  Just replace any author's name in your view with
> the helper method like I showed above and then test out your view by
> clicking on the author links and you'll see what happens.
>
> You can add a lot more to this helper method or build yourself an entire
> class for handling google queries and use methods from the class in your
> helpers, which is what I do.  I thought about handing out a plugin that
> does all of this, but because google changes things often, I don't want
> to have to manage a project at this time.  Maybe in the future
> sometime..
>
> --
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to