Class: Api::LazyElements::ElementsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controller/api/lazy_elements/elements_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



2
3
4
5
6
7
8
9
# File 'app/controller/api/lazy_elements/elements_controller.rb', line 2

def show
  name = params[:id]
  attr = params[:attr]

  file_path = "#{LazyElements.config.template_path}#{name}"
  template_str = render_to_string(partial: file_path, locals: {attr: attr})
  render json: {template: template_str}
end