Displaying 4 results from an estimated 4 matches for "type_for".
Did you mean:
type_f32
2010 Mar 25
2
NoMethodError (private method `chomp' called for nil:NilClas
...oadify. So far
the application is working in development environment. But when I
switched to the production environment, it produced the following error.
NoMethodError (private method `chomp'' called for nil:NilClass):
/usr/lib/ruby/gems/1.8/gems/mime-types-1.16/lib/mime/types.rb:665:in
`type_for''
/usr/lib/ruby/gems/1.8/gems/mime-types-1.16/lib/mime/types.rb:730:in
`type_for''
app/controllers/assets_controller.rb:180:in `new_asset_from_params''
haml (2.2.22) rails/./lib/sass/plugin/rails.rb:20:in `process''
app/middleware/flash_session_cookie_middlew...
2006 Feb 06
2
File_field and Firefox
...lt;p><label for="document_data">Content</label><br/>
<%= file_field ''document'', ''upload'' %></p>
and in the model document.rb:
def upload=(upload_field)
self.filename=upload_field
self.content_type=MIME::Types.type_for(upload_field)
File.open(upload_field, "rb") { |f| #ERROR HERE
self.filename=File.basename(upload_field)
self.content=f.read
}
end
def base_part_of(file_name)
name=File.basename(file_name)
name.gsub(/[^\w._-]/,'''')...
2010 Oct 25
0
Rails 3 -NoMethodError (undefined method `original_filename
...# Controller
def create
@photo = @photoalbum.photos.build(:upload_file => params[:photo])
...
end
# Model
class Photo < ActiveRecord::Base
require ''mime/types''
...
def upload_file=(data)
data.content_type =
MIME::Types.type_for(data.original_filename).to_s
self.image = data
end
end
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To u...
2011 Aug 19
1
How to post a file via HTTP as multipart/form-data to Facebook?
I would like to post a new photo to a user using `Net::HTTP::multipart`
from a Heroku application to Facebook.
I have the following JSON object:
{"message"=>"My message",
"image"=>#<ActionDispatch::Http::UploadedFile:0x00000004242490
@original_filename="neEZYMAnBI.jpg",
@content_type="application/octet-stream",