Hi Folks,
I have this path configured in my html.rb file:
<td><%= link_to traces_by_original_exchange.short_exchange_id, list_trace_by_short_exchange_id_path(traces_by_original_exchange.short_exchange_id) %></td>
and this in my route.rg file
match 'esb/list_trace_by_short_exchanges' => 'esb#list_trace_by_short_exchanges', :as => :list_trace_by_short_exchange_id
the link above generates a path:
http://localhost:3000/esb/list_trace_by_short_exchanges.ID-swordfish-27243-1327514975752-13-85879
However in my controller: I need to be able to retrieve "ID-swordfish-27243-1327514975752-13-85879"
I have the listing below (in my controller):
def list_trace_by_short_exchanges @traces_by_short_exchanges = TblTrace.find_by_sql("select top (1) * from tbl_traces where short_exchange_id = '" + params[:id] + "' order by created_on desc")
respond_to do |format| format.html # show.html.erb format.json { render :json => params[:id] } end end
How do I retrieve that value?
Note that I had tried:
<td><%= link_to traces_by_original_exchange.short_exchange_id, traces_by_original_exchange.short_exchange_id %></td>
but the url turns out to be
http://localhost:3000/esb/ID-swordfish-27243-1327514975752-13-85879
but I need the url to be:
http://localhost:3000/esb/list_trace_by_short_exchanges/ID-swordfish-27243-1327514975752-13-85879
or atleast get that parameter:
ID-swordfish-27243-1327514975752-13-85879
in the function list_trace_by_short_exchanges in ym controller.
What is the best way to do this?