In an action I have a string representing a url for a get request. A
simple and seemingly ridiculous example might be something like the
following. What I’m trying to do is much more complicated but I think
this tiny example shows where I am stuck.
Into their browser a user types
“http://my.domain.com/admin/category/updates”. I have a controller
roughly like the following
class Admin::CategoryController < ApplicationController
# a url for a get request that isn’t actually hard coded like this
url = “/admin/category/info/1”
# the following line is the tricky one. str = get(url) render :text=>str
@category = Category.find(params[:id])
The “tricky” line needs to use config/routes.rb to parse the url and
create the params hash if a ‘?’ is in the url. The info action must
execute with the same session.
I’m sure I could somehow use render_component_as_string; however, I
don’t know how to access config/routes.rb to parse the url string to
prepare the arguments for render_component_as_string.
I’ve been struggling with this on and off for a couple months and have
asked here in a variety of forms. Any help greatly appreciated.