Sha256: 2637436f4043227d22ef6258175f9b0e708030d727b3236fec40676ebf708b7b
Contents?: true
Size: 812 Bytes
Versions: 2
Compression:
Stored size: 812 Bytes
Contents
module Prosperity class ApplicationController < ::Prosperity.parent_controller.constantize layout 'prosperity/application' 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
prosperity-0.0.11 | app/controllers/prosperity/application_controller.rb |
prosperity-0.0.10 | app/controllers/prosperity/application_controller.rb |