Class: BoardMessagesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/board_messages_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/board_messages_controller.rb', line 8

def create
  @board_message = BoardMessage.new(params[:board_message])
  if @board_message.save
    flash[:notice] = t('message_board.flashes.success_wait_moderation')
    redirect_to board_messages_path
  else
    @board_messages = BoardMessage.approved.paginate(:page => params[:page], :per_page => 12)
    render 'index'
  end
end

#indexObject



3
4
5
6
# File 'app/controllers/board_messages_controller.rb', line 3

def index
  @board_message = BoardMessage.new
  @board_messages = BoardMessage.approved.order('board_messages.date DESC').paginate(:page => params[:page], :per_page => 12)
end

#showObject



19
20
21
# File 'app/controllers/board_messages_controller.rb', line 19

def show
  @board_message = BoardMessage.includes(:board_replies).find(params[:id])
end