Partial view rails via browser URL

I have javascript that needs to load partial parts of rails - I would prefer not to repeat partial HTML in the javascript file.

Is there a way to make this partially accessible via the browser url so that JS can download it?

partial location:

shared/_search.html.erb

I would like to capture an html view something like this:

example.com/shared/search.html

Is it possible to explicitly redirect this or get it locally through the file system?

I do not want to create a controller just to make it partial for JS.

+3
source share
2 answers

. JS.

, . , JS .

, , ActiveController ( ), Rails Metal - http://railscasts.com/episodes/150-rails-metal

: - ( / ..). :

  • JS
  • JS , ( )
  • JS, , . , JS lib, Jaml
  • 2-3
+2

, . Rails.

render - .

+1

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


All Articles