Sha256: 5fc004019e9ce7a64f623517c3f606ba3dd621c80c64757f1d1dd5b580fe3e93
Contents?: true
Size: 755 Bytes
Versions: 1
Compression:
Stored size: 755 Bytes
Contents
module Prosperity class ApplicationController < ActionController::Base protected def set_error(model) flash[:error] = model.errors.full_messages.to_sentence end def render_json_error(msg, code = 400) render json: {error: msg}, status: code end def strong_params? defined?(ActionController::StrongParameters) end def now @now ||= Time.now end def period params.fetch(:period, 'week') end def end_time params[:end_time].present? ? Time.parse(params[:end_time].to_s) : now end def start_time params[:start_time].present? ? Time.parse(params[:start_time].to_s) : end_time - 3.months end helper_method :end_time, :start_time, :period end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prosperity-0.0.9 | app/controllers/prosperity/application_controller.rb |