Class: Liquidum::SandboxController

Inherits:
ApplicationController show all
Defined in:
app/controllers/liquidum/sandbox_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
22
# File 'app/controllers/liquidum/sandbox_controller.rb', line 14

def create
  return render_only if params[:render_only] == "commit"

  @sandbox.update(sandbox_attributes)

  respond_with @sandbox,
    collection_location: -> { edit_sandbox_path(@sandbox) },
    action: :edit
end

#editObject



24
25
26
27
28
# File 'app/controllers/liquidum/sandbox_controller.rb', line 24

def edit
  if @sandbox.valid?
    @sandbox.result = Liquidum.render(@sandbox.template, assigns: JSON.parse(@sandbox.context))
  end
end

#indexObject



7
8
# File 'app/controllers/liquidum/sandbox_controller.rb', line 7

def index
end

#newObject



10
11
12
# File 'app/controllers/liquidum/sandbox_controller.rb', line 10

def new
  render :edit
end

#updateObject



30
31
32
33
34
35
36
37
38
# File 'app/controllers/liquidum/sandbox_controller.rb', line 30

def update
  return render_only if params[:render_only] == "commit"

  @sandbox.update(sandbox_attributes)

  respond_with @sandbox,
    collection_location: -> { edit_sandbox_path(@sandbox) },
    action: :edit
end