Class: MailinglistClassController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MailinglistClassController
- Defined in:
- app/controllers/mailinglist_class_controller.rb
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/controllers/mailinglist_class_controller.rb', line 44 def edit @user = User.find(session[:user_id]) @mailinglist_class = MailinglistClass.find(params[:id]) if request.post? if @mailinglist_class.update_attributes(params[:mailinglist_class]) if @mailinglist_class.save flash[:notice] = 'The mailinglist class was successfully edited.' redirect_to :controller => 'account', :action => 'welcome' end end end end |
#new ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/mailinglist_class_controller.rb', line 11 def new @domain = User.find(session[:user_id]).domain if request.post? @mailinglist_class = MailinglistClass.new(params[:mailinglist_class]) if @mailinglist_class.save flash[:notice] = 'The mailinglist class was successfully added.' redirect_to :controller => "account", :action => "welcome" else flash[:notice] = 'ERR: the class could not be created' end end end |
#remove ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/mailinglist_class_controller.rb', line 25 def remove if request.post? begin MailinglistClass.find(params[:id]).destroy rescue MlClassInUseException flash[:notice] = 'Cannot remove a mailinglist class that is currently in use.' redirect_to :controller => 'account', :action => 'welcome' return end flash[:notice] = 'The mailinglist class was successfully removed.' redirect_to :controller => 'account', :action => 'welcome' else flash[:notice] = 'Click Delete to remove the mailinglist class.' redirect_to :action => 'edit', :id => params[:id] end end |
#show ⇒ Object
59 60 61 |
# File 'app/controllers/mailinglist_class_controller.rb', line 59 def show @mailinglist_class = MailinglistClass.find(params[:id]) end |