Class: Admin::SuggestionsController

Inherits:
AdminCartoonistController
  • Object
show all
Defined in:
app/controllers/admin/suggestions_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



2
3
4
# File 'app/controllers/admin/suggestions_controller.rb', line 2

def index
  @suggestions = Suggestion.shown.reverse_chronological
end

#showObject



16
17
18
# File 'app/controllers/admin/suggestions_controller.rb', line 16

def show
  @suggestion = Suggestion.find params[:id].to_i
end

#toggleObject



6
7
8
9
10
11
12
13
14
# File 'app/controllers/admin/suggestions_controller.rb', line 6

def toggle
  Suggestion.toggle! params

  if params[:id].present?
    redirect_to "/admin/suggestions/#{params[:id]}"
  else
    redirect_to "/admin/suggestions"
  end
end