Class: TopicsController

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

Instance Method Summary collapse

Instance Method Details

#createObject


16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/topics_controller.rb', line 16

def create
  topic.label = Whitelabel[:label_id]
  topic.user  = current_user
  if topic.save
    if current_user.email.blank?
      redirect_to(edit_user_path(current_user), notice: t("flash.add_email"))
    else
      redirect_to(topic_path(topic), notice: t("flash.topic_added"))
    end
  else
    redirect_to(new_topic_path, alert: topic.errors.full_messages.join(', '))
  end
end

#editObject


14
# File 'app/controllers/topics_controller.rb', line 14

def edit; end

#indexObject


11
# File 'app/controllers/topics_controller.rb', line 11

def index; end

#newObject


13
# File 'app/controllers/topics_controller.rb', line 13

def new; end

#showObject


12
# File 'app/controllers/topics_controller.rb', line 12

def show; end

#updateObject


30
31
32
33
34
35
36
# File 'app/controllers/topics_controller.rb', line 30

def update
  if topic.save
    redirect_to(topic_path(topic), notice: t("flash.topic_updated"))
  else
    redirect_to(edit_topic_path, alert: topic.errors.full_messages.join(', '))
  end
end