Class: Thredded::MessageboardGroupsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/thredded/messageboard_groups_controller.rb

Instance Method Summary collapse

Methods included from UrlsHelper

#delete_post_path, #edit_post_path, #edit_preferences_path, #edit_preferences_url, #mark_unread_path, #permalink_path, #post_path, #post_url, #quote_post_path, #search_path, #send_private_message_path, #topic_path, #topic_url, #unread_topics_path, #user_path

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/thredded/messageboard_groups_controller.rb', line 10

def create
  @messageboard_group = Thredded::MessageboardGroup.new(messageboard_group_params)
  authorize @messageboard_group, :create?

  if @messageboard_group.save
    redirect_to root_path, notice: I18n.t('thredded.messageboard_group.saved', name: @messageboard_group.name)
  else
    flash.now[:notice] = @messageboard_group.errors.full_messages.to_sentence

    render action: :new
  end
end

#newObject



5
6
7
8
# File 'app/controllers/thredded/messageboard_groups_controller.rb', line 5

def new
  @messageboard_group = Thredded::MessageboardGroup.new
  authorize @messageboard_group, :create?
end

#showObject



23
24
25
26
27
28
29
# File 'app/controllers/thredded/messageboard_groups_controller.rb', line 23

def show
  @group = Thredded::MessageboardGroup.where(id: params[:id])
  @groups = Thredded::MessageboardGroupView.grouped(
    policy_scope(Thredded::Messageboard.where(group: params[:id])),
    user: thredded_current_user
  )
end