adopt-a-hydrant/app/controllers/reminders_controller.rb

15 lines
391 B
Ruby
Raw Normal View History

2011-06-13 22:39:39 +00:00
class RemindersController < ApplicationController
respond_to :json
def create
@reminder = Reminder.new(params[:reminder])
if @reminder.save
HydrantMailer.reminder_email(@reminder.hydrant).deliver
@reminder.update_attribute(:sent, true)
2011-06-13 22:39:39 +00:00
render(:json => @reminder)
else
render(:json => {"errors" => @reminder.errors}, :status => 500)
end
end
end