3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/dataclips/clips_controller.rb', line 3
def show
@clip_id = params[:clip_id]
if initialize_clip(@clip_id)
@headers = (@clip_id, @schema.keys)
@clip = @klass.new params.slice(*@variables.keys)
respond_to do |format|
format.html do
begin
require_parameters
rescue ActionController::ParameterMissing => e
@error = e
render :require_variables
end
end
format.json do
begin
require_parameters
render_json_records(@clip, params[:page])
rescue ActiveRecord::StatementInvalid => e
render json: e.message, status: :unprocessable_entity
end
end
end
else
raise ActionController::RoutingError.new('Not Found')
end
end
|