Rails accessing a view partial via the browser url?

You don't need to create a new controller file. But you do need an action to respond to the incoming request from your JS That action can render a partial specifically if you want. You can also generalize the action by having the JS ask for the partial by name as one of the parameters to the action If the issue is that you need to rapidly service a zillion of these calls coming in and you don't need the ActiveController machinery (you don't want to create a controller instance for the request), you could use Rails Metal railscasts.com/episodes/150-rails-metal Added: Another option is to store a template file on your server (in public/assets etc).

Then: JS retrieves template once per page load JS makes call to rails with params, to retrieve just the response (no markup) JS, locally on the browser, merges the response into the template. Either step by step or by using a JS lib such as Jaml Repeat steps 2-3 ad infinitum.

You don't need to create a new controller file. But you do need an action to respond to the incoming request from your JS. That action can render a partial specifically if you want.

You can also generalize the action by having the JS ask for the partial by name as one of the parameters to the action. If the issue is that you need to rapidly service a zillion of these calls coming in and you don't need the ActiveController machinery (you don't want to create a controller instance for the request), you could use Rails Metal -- railscasts.com/episodes/150-rails-metal Added: Another option is to store a template file on your server (in public/assets etc). Then: JS retrieves template once per page load JS makes call to rails with params, to retrieve just the response (no markup) JS, locally on the browser, merges the response into the template.

Either step by step or by using a JS lib such as Jaml Repeat steps 2-3 ad infinitum.

As mentioned above, you will still need to create an action in a controller. Controllers are always required to map an incoming request in Rails. The render method contains a range of options for presenting content - you can load a file directly, or even generate inline text to return as the result of the action call.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions