Class: ActionPrompt::PreviewsController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- ActionPrompt::PreviewsController
- Defined in:
- app/controllers/action_prompt/previews_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
Ideally, we’d like to inhert from Rails::ApplicationController, but that would prevent us from using a Tailwind CDN.
- #show ⇒ Object
Instance Method Details
#index ⇒ Object
Ideally, we’d like to inhert from Rails::ApplicationController, but that would prevent us from using a Tailwind CDN. So instead, we’re using ActionController::Base.
If we are able to use Rails::ApplicationController, then re-enable this line before_action :require_local!
10 11 12 13 |
# File 'app/controllers/action_prompt/previews_controller.rb', line 10 def index @page_title = "Action Prompt Previews" @previews = ActionPrompt::Preview.all end |
#show ⇒ Object
15 16 17 18 19 20 21 |
# File 'app/controllers/action_prompt/previews_controller.rb', line 15 def show preview_class_name = params[:preview_slug].camelize + "Preview" @preview_class = ActionPrompt::Preview.find(preview_class_name) slug = "#{params[:preview_slug]}/#{params[:prompt_name]}" @prompt = @preview_class.find_prompt(slug) @prompt_output = @preview_class.new.send(params[:prompt_name].to_sym) end |