This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :address do | |
task :import do | |
file_name = 'data.txt' | |
puts 'Started Importing' | |
require "csv" | |
CSV.foreach(file_name, :quote_char => '"', :col_sep =>'\t', :row_sep =>:auto) do |row| | |
puts row[0] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
post :index do | |
#determine the querystring which is NOT restful and route to approriate view | |
#URL looks like this http://localhost/app?create&id=10 | |
url = env['REQUEST_URI'] | |
uri = Addressable::URI.parse(url).query_values.to_hash | |
#Provide Server Info text per spec | |
if uri.has_key?("create") | |
tmp_dir = File.join(Padrino.root, 'tmp') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTTP/1.1 200 (OK) | |
Server: Microsoft-IIS/4.0 | |
Date: Wed, 04 Nov 1998 07:41:03 GMT | |
Content-Type: multipart/form-data; | |
boundary=A495ukjfasdfddrg4hztzu... | |
Content-Length: 32413 | |
X-dateC: 1998-10-07 | |
X-timeC: 07:55:57 | |
X-dateM: 1998-10-07 | |
X-timeM: 07:55:57 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UploadedFile < CarrierWave::Uploader::Base | |
SEPARATOR = "\r\n".freeze | |
attr_reader :body | |
include CarrierWave::MimeTypes | |
process :set_content_type | |
def filename | |
@name = key | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
belongs_to :locker, :class_name => "User", | |
:condition => lambda { {:conditions => ["lock_until < ? ", Time.now]}} |