Class: Api::V1::WorkUnitsController
- Inherits:
-
BaseController
- Object
- BaseController
- Api::V1::WorkUnitsController
- Defined in:
- app/controllers/api/v1/work_units_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/api/v1/work_units_controller.rb', line 13 def create @work_unit = WorkUnit.new(params[:work_unit]) @work_unit.user = current_user if @work_unit.save render :json => {:success => true} and return else Rails.logger.warn @work_unit.errors..to_sentence render :json => {:succes => false, :errors => @work_unit.errors..to_sentence} and return end end |
#index ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'app/controllers/api/v1/work_units_controller.rb', line 2 def index get_calendar_details bucket = WorkUnit.scheduled_between(@start_date, @start_date + 6.days) if params[:external_only] client = SiteSettings.first.try(:client) bucket = bucket.except_client(client) end @work_units = bucket.all render :json => @work_units end |