Sha256: 93f43ccc2b7733ce487f20d7e88a3b7fbb2d70bc8d10a8fb359c6e908ae26c52

Contents?: true

Size: 641 Bytes

Versions: 15

Compression:

Stored size: 641 Bytes

Contents

class E9Crm::ContactMergesController < E9Crm::BaseController
  before_filter :build_resources

  def create
    if @contact_a.update_attributes(params[:contact])
      @contact_a.merge_and_destroy!(@contact_b)
      redirect_to @contact_a
    else
      render :new
    end
  end

  protected

  def build_resources
    @contact   ||= Contact.new
    @contact_a ||= Contact.find(params[:contact_a_id])

    # NOTE lets see if this works
    @contact_b ||= if params[:contact]
                     Contact.new(params[:contact])
                   else
                     Contact.find(params[:contact_b_id])
                   end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
e9_crm-0.1.19 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.18 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.17 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.16 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.14 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.13 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.12 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.11 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.10 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.8 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.7 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.6 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.5 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.4 app/controllers/e9_crm/contact_merges_controller.rb
e9_crm-0.1.1 app/controllers/e9_crm/contact_merges_controller.rb