Sha256: fb8efa452e6b67bb7dd871cd7adda9be440c53b69053b3eeba66446e276fc135
Contents?: true
Size: 1.65 KB
Versions: 11
Compression:
Stored size: 1.65 KB
Contents
# frozen_string_literal: true module MrCommon module Reminders class RemindersController < BaseController def show @reminder = Reminder.find(params[:id]) end def index @reminders = Reminder.order(start_time: :asc) end def new @reminder = Reminder.new end def edit @reminder = Reminder.find(params[:id]) end def create @reminder = Reminder.new(reminder_params) if @reminder.save redirect_to @reminder, notice: "Reminder saved." else flash.now[:alert] = "Reminder not saved. Check the form for errors." render :new, status: :unprocessable_entity end end def update @reminder = Reminder.find(params[:id]) if @reminder.update(reminder_params) redirect_to @reminder, notice: "Reminder updated." else flash.now[:alert] = "Reminder not updated. Check the form for errors." render :edit, status: :unprocessable_entity end end def destroy @reminder = Reminder.find(params[:id]) if @reminder.destroy redirect_to reminders_path, alert: "Reminder destroyed." else redirect_to @reminder, alert: "Unable to destroy reminder" end end private def reminder_params params.require(:reminder).permit( :summary, :description, :time_zone, :slug, :start_time, :end_time, :location, :all_day, :include_in_confirmation_mailer ) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems