Prevent Ruby On Rails Automatic Parameter Downcasing -
i have strange problem on rails 3.2 haven't been able nail down. i'm obfuscating parameters given resource provide basic access security (this isn't sensitive data, want make sure guest user gets place deliberately , can't enter in other ids). this, overloaded to_param
method of 1 of models.
def to_param encrypt id end
the encrypt
method returns base64 hash. example: xa_bvjbh1zzuq2fqlnb4ta==
when call model's path helpers, url gets constructed correctly, both params[:id]
, request.url
lowercasing hash! causing headaches, might imagine.
contextual examples:
object.to_param # xa_bvjbh1zzuq2fqlnb4ta== params[:id] # xa_bvjbh1zzuq2fqlnb4ta== request.url # http://localhost:3000/objects/xa_bvjbh1zzuq2fqlnb4ta== object_path(id: object.last.to_param) # "/objects/xa_bvjbh1zzuq2fqlnb4ta=="
can provide insight on why may occurring?
may want check , see if else on team implemented automatically downcase to_params, in order make urls case insensitive. feel isn't default behavior.
Comments
Post a Comment