10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'app/controllers/rails_vitals/playgrounds_controller.rb', line 10
def create
expression = params[:expression].to_s.strip
clean_expr = clean_expression(expression)
access_associations = Array(params[:access_associations]).reject(&:blank?)
result = Playground::Sandbox.run(
expression,
access_associations: access_associations
)
model_name = Playground::Sandbox.(expression)
@available_assocs = associations_for_model(model_name)
@prechecked_assocs = access_associations
@expression = clean_expr
@result = result
@previous = session_previous
@query_dna = build_dna(result.queries)
session[:playground_previous] = serialize_result(result, clean_expr, access_associations)
render :index
end
|