Class: PeekAView::ViewsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- PeekAView::ViewsController
- Defined in:
- app/controllers/peek_a_view/views_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/peek_a_view/views_controller.rb', line 4 def index PeekAView.load_views @views = config.views.keys.sort respond_to do |format| format.html do render template: '/peek_a_view/views/index' end format.json do absolute = { protocol: request.protocol, host: request.host, port: request.port } render json: @views.map { |v| peek_a_view_engine.view_url(v, absolute) } end end end |
#show ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/peek_a_view/views_controller.rb', line 22 def show PeekAView.load_views if (view = find_view) render_template(view, params) else render text: "No such template", status: :not_found end end |
#url_options ⇒ Object
33 34 35 36 |
# File 'app/controllers/peek_a_view/views_controller.rb', line 33 def # Substitute stubbed params for URL generation. { _path_segments: @params } end |