Class: Admin::TopicsController

Inherits:
ResourcesController
  • Object
show all
Defined in:
app/controllers/admin/topics_controller.rb

Instance Method Summary collapse

Instance Method Details

#add_to_next_eventObject


2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/admin/topics_controller.rb', line 2

def add_to_next_event
  @topic = Topic.find(params[:id])
  @user  = @topic.user

  if @event = Event.current.first
    @topic.event = @event
    @event.particpate(@user)
    @topic.save!
    redirect_to url_for(controller: "/admin/topics", action: :edit, id: @topic.id), notice: "Added to latest Event!"
  else
    redirect_to(url_for(controller: "/admin/topics", action: :index), alert: "no next event found")
  end
end