Class: OnboardOnRails::Api::EventsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- OnboardOnRails::ApplicationController
- BaseController
- OnboardOnRails::Api::EventsController
- Defined in:
- app/controllers/onboard_on_rails/api/events_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/onboard_on_rails/api/events_controller.rb', line 4 def create event = Event.new( user_id: current_user.id, name: params[:name], payload: params[:payload] || {} ) if event.save render json: { event: { id: event.id, name: event.name } }, status: :created else render json: { errors: event.errors. }, status: :unprocessable_entity end end |