Sha256: 9f97f78e499c851b4da2fbaaac98647c4399db9a075bd8748b39247bde7f6f33

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

# encoding: utf-8

module InvoiceBar
  class ContactsController < InvoiceBar::ApplicationController    
    inherit_resources
    respond_to :html, :json
    
    before_filter :require_login

    def new
      @contact = Contact.new
      @contact.build_address

      new!
    end

    def create
      @contact = Contact.new(params[:contact])    
      current_user.contacts << @contact
      
      @contact.build_address unless @contact.address

      create! {}
    end
    
    def update
      update! {}
    end
    
    def destroy
      destroy! {}
    end
  
    protected
  
      def collection
        @contacts ||= end_of_association_chain.page(params[:page])
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
invoice_bar-0.0.3 app/controllers/invoice_bar/contacts_controller.rb
invoice_bar-0.0.2 app/controllers/invoice_bar/contacts_controller.rb
invoice_bar-0.0.1 app/controllers/invoice_bar/contacts_controller.rb