class GtfsEngine::JsonResponder
This file is part of the KNOWtime server.
The KNOWtime server is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
The KNOWtime server is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the KNOWtime server. If not, see <www.gnu.org/licenses/>.
Public Instance Methods
to_json()
click to toggle source
# File lib/gtfs_engine/json_responder.rb, line 16 def to_json if has_errors? display_errors else default_render end end
Protected Instance Methods
display_errors()
click to toggle source
# File lib/gtfs_engine/json_responder.rb, line 26 def display_errors status_code = options[:status] || :unprocessable_entity data = { status: 'error', data: resource_errors[:errors] } controller.render format => data, status: status_code end