Skip to content

Instantly share code, notes, and snippets.

View brandon-beacher's full-sized avatar
💭
🦑

Brandon Beacher brandon-beacher

💭
🦑
View GitHub Profile
module Importers
class PhoneRow < ObjectRow
self.abstract_class = true
def to_phone
Phone.new \
:extension => get_extension,
:kind => get_kind,
:number => get_number,
:primary => get_primary,
module Importers
class PeopleImporter < ObjectsImporter
private
def self.import_type
Person.class_name
end
def self.before_create_object(person)
Fri Jun 26 12:20:31 -0400 2009: Read error: #<ArgumentError: A copy of DigitalFaith::Management::PeopleController has been removed from the module tree but is still active!>
/Users/brandon/Sites/rails/dfc/vendor/rails/activesupport/lib/active_support/dependencies.rb:414:in `load_missing_constant'
/Users/brandon/Sites/rails/dfc/vendor/rails/activesupport/lib/active_support/dependencies.rb:96:in `const_missing'
/Users/brandon/Sites/rails/dfc/app/controllers/digital_faith/management/people_controller.rb:20:in `index'
/Users/brandon/Sites/rails/dfc/vendor/rails/actionpack/lib/action_controller/response.rb:153:in `call'
/Users/brandon/Sites/rails/dfc/vendor/rails/actionpack/lib/action_controller/response.rb:153:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/chunked.rb:37:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/handler/mongrel.rb:74:in `process'
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client_without_proctitle'
/opt/local/lib/ruby/gems/1
(Status-Line) HTTP/1.1 200 OK
Connection close
Date Mon, 29 Jun 2009 19:56:57 GMT
Transfer-Encoding chunked
Content-Type text/csv; charset=utf-8
X-Runtime 180
Content-Disposition attachment; filename="people.csv"
Set-Cookie _dfc_session=...
Cache-Control no-cache
(Status-Line) HTTP/1.1 200 OK
Date Mon, 29 Jun 2009 19:59:41 GMT
Server Mongrel 1.1.4
Status 200
X-Runtime 1008
Content-Disposition attachment; filename="people.csv"
Cache-Control no-cache, private
Content-Type text/csv; charset=utf-8
Content-Length 118830
Set-Cookie _dfc_session=...
@worker = MiddleMan.worker("people_export_worker", UUIDTools::UUID.random_create.to_s)
@worker.async_export(:data => { :customer_id => current_customer.id, :params => params })
redirect_to management_people_path(:context => "export_status", :worker_key => @worker.worker_key) and return
respond_to do |format|
format.html { render not_found_action, :status => :not_found }
format.all { head :not_found }
end
var UploadHelper = {
load: function(element, options) {
this.element = element;
this.options = {
button_cursor : SWFUpload.CURSOR.HAND,
button_window_mode : SWFUpload.WINDOW_MODE.WINDOW,
flash_url : '/javascripts/swfupload_2_2_0_1/Flash/swfupload.swf',
file_queued_handler : this.file_queued.bind(this),
file_queue_error_handler : this.file_queue_error.bind(this),
upload_error_handler : this.upload_error.bind(this),
require 'fastercsv'
class Importer
def self.import_products(folder)
assets = {}
FasterCSV.foreach("#{folder}/assets.csv") do |row|
assets[row[0]] = row[1]
end
namespace :ksw do
namespace :import do
desc "Imports products from FOLDER"
task :products => :environment do
Importer.import_products ENV['FOLDER']
end
end
end