Sha256: 7e34172be35f40288a6e8594b75d254d03199caa3672e9c7a6ce64a6207f2dc5

Contents?: true

Size: 1.57 KB

Versions: 6

Compression:

Stored size: 1.57 KB

Contents

class MailinglistController < ApplicationController
    verify :only => [ 'show', 'edit', 'destroy' ],
        :params => :id,
        :add_flash => { :notice => 'Missing mailinglist ID.' },
        :redirect_to => { :action => 'list' }

    def destroy
        if request.post?
            Mailinglist.find(params[:id]).destroy
            flash[:notice] = 'The mailinglist was successfully destroyed.'
            redirect_to :action => 'list'
        else
            flash[:notice] = 'Click Destroy to destroy the mailinglist.'
            redirect_to :action => 'edit', :id => params[:id]
        end
    end

    def edit
        if request.post?
            @mailinglist = Mailinglist.find(params[:id])
            if @mailinglist.update_attributes(params[:mailinglist])
                if @mailinglist.save
                    flash[:notice] = 'The mailinglist was successfully edited.'
                    redirect_to :action => 'show', :id => @mailinglist
                end
            end
        else
            @mailinglist = Mailinglist.find(params[:id])
        end
    end

    def list
        @mailinglist_pages, @mailinglists = paginate(:mailinglists)
    end

    def new
        if request.post?
            @mailinglist = Mailinglist.new(params[:mailinglist])
            if @mailinglist.save
                flash[:notice] = 'A new mailinglist was successfully added.'
                redirect_to :action => 'list'
            end
        else
            @mailinglist = Mailinglist.new
        end
    end

    def show
        @mailinglist = Mailinglist.find(params[:id])
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sugoi-mail-0.0.3 app/controllers/mailinglist_controller.rb
sugoi-mail-0.0.0 app/controllers/mailinglist_controller.rb
sugoi-mail-0.0.2 app/controllers/mailinglist_controller.rb
sugoi-mail-0.1.0 app/controllers/mailinglist_controller.rb
sugoi-mail-0.0.1 app/controllers/mailinglist_controller.rb
sugoi-mail-0.0.5 app/controllers/mailinglist_controller.rb