Yeah, URI is the library to work with. You could tighten it up and
just do:
homepage = URI.parse("http://www.nyt.com/sports/lakers/123/").host
On the model, you could put "require 'uri' " but I think its loaded
with Rails by default.
--Tom
I don't think
On May 28, 12:19 pm, Sean Six <[email protected]>
wrote:
> tomrossi7 wrote:
> > Sean,
>
> > Are you saving this url to the model? I'm not sure what you mean by
> > shorten it up?
>
> > --Tom
>
> I want a user to submit a link to a webpage. After they submit the link
> I want to parse it to the homepage url. Like if the article
> iswww.nyt.com/sports/lakers/123. I want to have this shortened to the
> homepage link nyt.com. You can try it in the interpreter as someone
> posted above.
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---