19 lines
515 B
Ruby
19 lines
515 B
Ruby
|
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
|