Sha256: d6b032cdea9fdfd0157042afb38e1d5c0f83a0a913fa10171caa025aa23b9505

Contents?: true

Size: 793 Bytes

Versions: 12

Compression:

Stored size: 793 Bytes

Contents

class ContactsController < ApplicationController
  before_filter :get_index, :only => [:new]
  before_filter :authenticate_admin!, :except => [:new, :create]
  
  def index
    @contacts = Contact.all
  end
  
  def show
    @contact = Contact.find(params[:id])
  end
  
  def new
    @contact = Contact.new
    render :layout => false
  end
  
  def create
    @contact = Contact.new(params[:contact])
    if @contact.save
      flash[:notice] = "Your message has been sent."
      redirect_to root_url
    else
      render :action => 'new'
    end
  end
  
  def destroy
    @contact = Contact.find(params[:id])
    @contact.destroy
    flash[:notice] = "Successfully destroyed contact."
    redirect_to contacts_url
  end

  def get_index
    Index.find_by_name(controller_name)
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
sbdevcore-0.1.2 app/controllers/contacts_controller.rb
sbdevcore-0.1.1 app/controllers/contacts_controller.rb
sbdevcore-0.1.0 app/controllers/contacts_controller.rb
sbdevcore-0.0.9 app/controllers/contacts_controller.rb
sbdevcore-0.0.8 app/controllers/contacts_controller.rb
sbdevcore-0.0.7 app/controllers/contacts_controller.rb
sbdevcore-0.0.6 app/controllers/contacts_controller.rb
sbdevcore-0.0.5 app/controllers/contacts_controller.rb
sbdevcore-0.0.4 app/controllers/contacts_controller.rb
sbdevcore-0.0.3 app/controllers/contacts_controller.rb
sbdevcore-0.0.1 app/controllers/contacts_controller.rb
sbdev-core-0.0.1 app/controllers/contacts_controller.rb