15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/concerns/view_specs/preview_actions.rb', line 15
def preview
spec = ViewSpec.specs.find_where(lookup_path: params[:spec])
raise ActionController::RoutingError, "Spec not found" unless spec
entry = spec.entries.find_where(short_identifier: params[:entry])
raise ActionController::RoutingError, "`#{params[:entry]}` not found for spec `#{spec.subject}`" unless entry
preview = entry.preview(params: view_spec_preview_params)
options = {}
layout = entry.determine_layout(self.class._layout) || ViewSpec.config.preview_layout
(options[:layout] = layout) if layout
render preview, **options
end
|