Change another template based on where the request was called from?

I am invoking a controller action to perform an AJAX request search from two different pages and want to display a different rjs file based on which page requested the action. I could just do 2 actions to do this, but it doesn't seem very dry when the same code in the action just needs different rjs as it displays the search results differently in the presentation.

Using Rails 2.3.4 and Ruby 1.8.7

+3
source share
3 answers

If I understand your question correctly, you need to solve three ways:

  • http_referrer , . , , , , .
  • AJAX GET, , . Rails RJS.
  • - , A URL-, B .

№ 2, , , , , №3 . , , , . , ...

+3

? . , .

+1

# 2 , . ApplicationController mime, .

, (: "show.employees-autocomplete.rjs", "show.quotation-autofill.rjs" ).

0

Source: https://habr.com/ru/post/1722023/