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