Class: Liquidum::SandboxController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

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



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

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

#indexObject



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

def index; end

#newObject



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

def new
  render :edit
end

#updateObject



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

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