16 lines
407 B
Ruby
16 lines
407 B
Ruby
class RemindersController < ApplicationController
|
|
respond_to :json
|
|
|
|
def create
|
|
@reminder = Reminder.new(params[:reminder])
|
|
@reminder.from_user = current_user
|
|
if @reminder.save
|
|
ThingMailer.reminder(@reminder.thing).deliver
|
|
@reminder.update_attribute(:sent, true)
|
|
render(json: @reminder)
|
|
else
|
|
render(json: {errors: @reminder.errors}, status: 500)
|
|
end
|
|
end
|
|
end
|