No new directions

It’s been a long few days. The last two were spent finally emptying out the Michigan Avenue apartment. It’s an odd feeling now. There were some incredible memories from that apartment. But there is always a time to move on, and to find a place to build new memories. It’s not California (yet?), but it’s Ballston (a neighborhood of Arlington) in Northern Virginia. We’ll see how things go here. It really depends how long I stay where I’m at, etc.

I want to push into film work. My boss wants to wait 2, 3, maybe 4 years. Well, I don’t want to wait. So I’m pursuing it anyway. And if I am able to market the job and land it and the company doesn’t want to take it? Como se dice “the NMD goes full time”. Werd up.

And now it’s the inauguration. And I have to go downtown to work. Damn loonies everywhere. Give me back my city. (damnit).

  1. Edison says:

    That's right Uploadify doesn't return them diclrtey. A bit of Paperclip magic happens here Have a look at this example:This is what arrives at our controller. Log it vialogger.info params.inspectin your create-action.Parameters: "Filename" => "example.jpg", "format" => "json", "action" => "create", "folder" => "/users/", "Upload" => "Submit Query", "session_encoded" => "...x53x48x102x54x57x56x99x54x...", "model_id" => "1", "user" => "photo" => #<File:/tmp/RackMultipart20100920-1122-1lsvp1d-0>}}Now create an User-Object from this params:@user = User.new params :user Logging this object vialogger.info @user.inspectgives you<User id: nil, photo_file_name: "example.jpg", photo_content_type: "application/octet-stream", photo_file_size: 7984, photo_updated_at: "2010-09-20 11:31:12", created_at: nil, updated_at: nil>You can see that the attributes photo_file_name , photo_content_type , photo_file_size and photo_updated_at are set magically from Paperclip. Only problem here is photo_content_type we don't want application/octet-stream (that's sent by Flash). The trick here is to use the gem Mime-Types. Require it in your Gemfile:gem 'mime-types', :require => 'mime/types'In your create-action you can now set photo_content_type manually:mime_type = MIME::Types.type_for @user.photo_file_name @user.photo_content_type = mime_type.first.content_type.to_s if mime_type.firstLogging @user again gives you now:<User id: nil, photo_file_name: "example.jpg", photo_content_type: "image/jpeg", photo_file_size: 7984, photo_updated_at: "2010-09-20 11:31:12", created_at: nil, updated_at: nil>Hope I could help, Dirk.

Post a comment

Name or OpenID (required)


(lesstile enabled - surround code blocks with ---)