Class: Admin::ModeratorsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Admin::ModeratorsController
- Defined in:
- app/controllers/admin/moderators_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/controllers/admin/moderators_controller.rb', line 13 def create @moderator = Moderator.new(params[:moderator]) if @moderator.save flash[:notice] = "Account created!" redirect_to admin_moderators_url else render :action => :new end end |
#destroy ⇒ Object
50 51 52 53 54 55 |
# File 'app/controllers/admin/moderators_controller.rb', line 50 def destroy @moderator = Moderator.find(params[:id]) @moderator.destroy flash[:notice] = "Account deleted!" redirect_to admin_moderators_url end |
#edit ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/admin/moderators_controller.rb', line 27 def edit if current_moderator != @moderator @title = "Moderators" @cancel_url = admin_moderators_path else @title = "Edit Account" @cancel_url = admin_dashboard_path end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/admin/moderators_controller.rb', line 5 def index @moderators = Moderator.find(:all, :conditions => ["id != ?", current_moderator.id]) end |
#new ⇒ Object
9 10 11 |
# File 'app/controllers/admin/moderators_controller.rb', line 9 def new @moderator = Moderator.new end |
#show ⇒ Object
23 24 25 |
# File 'app/controllers/admin/moderators_controller.rb', line 23 def show @moderator = @current_moderator end |
#update ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/admin/moderators_controller.rb', line 37 def update if @moderator.update_attributes(params[:moderator]) flash[:notice] = "Account updated!" if current_moderator != @moderator redirect_to admin_moderators_url else redirect_to admin_dashboard_path end else render :action => :edit end end |