To note, I only have the URI in a string as its from a POST from an external API as JSON Data. Basically I need this: http://www.someapp.com/events/12345 I just need the 12345 Obviously, params[:id] won''t work so I''m not sure how to get this. I tried this: url = data[''referring_site''] event_id = CGI::parse(URI::parse(url).query) But it didn''t work. Where the referring_site was the URL in question. Thanks Brad -- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Is there anything wrong with: data[''referring_site''].split("/").last Which will give you what you are looking for, assuming that is the limit of your URL? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/vjlUW1ux_IMJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Beauty!!!! Thats it. Thank you. Knew it was a string call, just not sure which one. Especially coming from the PHP world. Thanks again. B On Nov 24, 8:29 pm, JGW Maxwell <jgwmaxw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is there anything wrong with: > > data[''referring_site''].split("/").last > > Which will give you what you are looking for, assuming that is the limit of > your URL?-- 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
bradigan wrote in post #1033619:> To note, I only have the URI in a string as its from a POST from an > external API as JSON Data. > Basically I need this: > > http://www.someapp.com/events/12345For what it''s worth, a request to that URL should be sent using the HTTP PUT method. If I''m not mistaken Rails should then automatically provide "12345" in params[:id]. But, the provided solutions should work for your needs. -- Posted via http://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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.