Possible Duplicate:
How do I easily parse a URL with parameters in a Rails test?
sorry for my english...
I have in my archives.rb model a method to get all src attributes from a html content, I am getting src's like:
http://localhost:3000/es/editor/archives/28/show_image?x=142&y=142
I need to get the params from that url, specifically: id, x, y
Thanks, Regards.
The correct approach :
url = "http://localhost:3000/es/editor/archives/28/show_image?x=142&y=142"
uri = URI::parse(url)
id = uri.path.split('/')[4]
params = CGI::parse(uri.query)
In your controller you can do 'params[:x]' and 'params[:y]'. For example:
x = params[:x]
y = params[:y]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With