Sha256: 7cc0566101e5db78da315cec17ee67e1572edf6b77dae7899e96413be0170ba3

Contents?: true

Size: 943 Bytes

Versions: 7

Compression:

Stored size: 943 Bytes

Contents

module Newsletter
  class FieldsController < ::Newsletter::ApplicationController  
    before_filter :find_field, :except => [:index, :new, :create]

    def index
      @fields = NewsletterField.find(:all)
    end

    def show
    end

    def new
      @field = NewsletterField.new
    end

    def edit
    end

    def create
      @field = Field.new(params[:field])
      if @field.save
        flash[:notice] = 'NewsletterField was successfully created.'
        redirect_to(@field)  
      else
        render :action => "new"
      end
    end

    def update
      if @field.update_attributes(params[:field])
        flash[:notice] = 'Field was successfully updated.'
        redirect_to(@field)
      else
        render :action => "edit"
      end
    end

    def destroy
      @field.destroy
      redirect_to(fields_url)
    end
    
    protected
    
    def find_field
      @field = Field.find(params[:id])
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
newsletter-3.0.2 app/controllers/newsletter/fields_controller.rb
newsletter-3.0.1 app/controllers/newsletter/fields_controller.rb
newsletter-3.0.0 app/controllers/newsletter/fields_controller.rb
newsletter-0.1.2 app/controllers/newsletter/fields_controller.rb
newsletter-0.1.1 app/controllers/newsletter/fields_controller.rb
newsletter-0.1.0 app/controllers/newsletter/fields_controller.rb
newsletter-0.0.1 app/controllers/newsletter/fields_controller.rb