Class: Thredded::SetupsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#signed_in?

Instance Method Details

#create ⇒ Object



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

def create
  @messageboard = Messageboard.new(messageboard_params)

  if signed_in? && @messageboard.save
    @topic = Topic.create!(topic_params)
    @post = Post.create!(post_params)

    redirect_to root_path
  else
     unless signed_in?
    render action: :new
  end
end

#new ⇒ Object



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

def new
   unless signed_in?
  @messageboard = Messageboard.new
end