Class: PlasticineController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/plasticine_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/plasticine_controller.rb', line 4

def show
  if @granted
    # set_default_to if params[:from] and not params[:to]

    builder = "Plasticine::Builder::#{params[:nature].camelize}".constantize.new(params[:id], params)

    visual_model.build builder

    respond_to do |format|
      format.json { render json: builder.to_json }
    end
  else
    respond_to do |format|
      format.json { render json: { 'state' => 'access_refused' } }
    end
  end
end