ruby on rails - Encoding characters in restful resource path with ActiveResource -


i've created rest api existing system utilizing rails , attempting consume in external system via activeresource. unfortunately primary key of 1 of core tables arbitrary string defined user many non-url friendly characters have been used on years. we've ended keys such "cr 1400/2400 a-c", activeresource not encoding correctly restful url. deals spaces correctly, not encode forward slashes amongst other characters.

i able call find method primary key containing these forbidden characters such as:

p = project.find('cr 1400/2400 a-c') 

which result in url such as:

http://localhost:3000/projects/cr%201400%2f2400%20a-c.json

instead of:

http://localhost:3000/projects/cr%201400/2400%20a-c.json

i cannot change database schema though little bring me greater joy.

is there way tell activeresource encode additional characters, or intercept call encode them prior constructing url?

thanks in advance

neil


Comments