foodsoft/plugins/messages/app/controllers/messagegroups_controller.rb

18 lines
514 B
Ruby
Raw Normal View History

class MessagegroupsController < ApplicationController
def index
@messagegroups = Messagegroup.order("name")
end
def join
@messagegroup = Messagegroup.find(params[:id])
@messagegroup.users << current_user
redirect_to messagegroups_url, :notice => I18n.t('messagegroups.join.notice')
end
def leave
@messagegroup = Messagegroup.find(params[:id])
@messagegroup.users.destroy(current_user)
redirect_to messagegroups_url, :notice => I18n.t('messagegroups.leave.notice')
end
end