Displaying 20 results from an estimated 300 matches similar to: "Another RSpec on Rails issue: how to test send_file()"
2007 May 30
2
should_eql etc?
Hi, I''m trying the specs for restful_authentication I found here
http://jonathan.tron.name/articles/2007/01/02/rspec-on-rails-restful-
authentication
It seems to use custom .should methods: should_eql,
should_be_an_instance_of, should_redirect_to, should_be_success,
should_not_be_nil, should_be_nil, should_not_be_nil, should_be_empty,
should_be_success, should_not_change, and
2011 Mar 26
2
upload file, read first 10 lines.
I have a csv file and in my controller:
uploaded_file = params[:upload][:csv].read
@rows << FasterCSV.parse(uploaded_file)
I want to put in @rows only the first 10 lines but the read method
reads all the file.
How can I do?
--
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
2006 Jun 20
2
Problem with "can''t dump anonymous class Class"
I submitted this earlier, but the web forums went down and I''ve screwed up
the thread, so I''m starting over.
I''m trying to built a document upload system. The system has a main
Document model with different subclasses for different types of documents.
With the code below, if I attempt to create a Document, it works fine, but
if I attempt to use one of the subclasses, I
2007 May 16
1
Rails, Mongrel and Rmagick
i have a rails app with a form that allows uploading an image file. I take
the image file and read it into rmagick to verify that it''s an image. For
some reason I can''t catch an exception thrown by rmagick inside the app.
After an invalid image file is uploaded the process just hangs. I have to
kill mongrel and restart to use the app again.
img =
2006 Jun 08
1
Permissions on uploaded files, TinyFile
Hi, im getting a little trouble with this, im using TinyFile as the
example to upload files
http://wiki.rubyonrails.com/rails/pages/TinyFile/versions/20
All goes well but the files uploaded are saved with permissions 600
(linux) and in the case of images arent showed on the browser(but
uploaded and stored in the server without problems) i have to manually
ftp to the uploaded files folder and
2006 Jul 26
4
Upload File
I got this error:
NoMethodError in PictureController#new
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.uploaded_file=
and the line code is here:
@picture.uploaded_file = @params[''picture_file'']
--
Posted via http://www.ruby-forum.com/.
2006 Jun 09
8
[how can i delete a file system..please help]
Hi,
I''m trying to delete a file system (<xml_26548975.xml>)
File.delete("xml_26548975.xml")
But I get this error:
"Permission denied - ./script/../config/../uploads/xml_26548975.xml".
Why?
--
Cheers,
ioana k&a
http://boulangerie.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2010 Apr 24
2
problem using attachment_fu with S3
Hi,
My S3 bucket is located in the US
I have attachment_fu working when using file system storage
I have sw-swf upload plugin working with my S3 account
but I can not get attachment_fu to work with S3 storage.
the error I get is :
AWS::S3::RequestTimeout in Upload filesController#create
Your socket connection to the server was not read from or written to
within the timeout period. Idle
2013 Jan 18
6
[PATCH v1 01/02] HVM firmware passthrough libxl support
This patch introduces support for two new parameters in libxl:
smbios_firmware=<path_to_smbios_structures_file>
acpi_firmware=<path_to_acpi_tables_file>
The changes are primarily in the domain building code where the firmware files
are read and passed to libxc for loading into the new guest. After the domain
building call to libxc, the addresses for the loaded blobs are returned and
2006 Mar 29
7
Uploading files and writing them to server?
Where should I look for information on how to use Rails and Ruby to
accept the upload of a file and then to save that file to the file
system of my server?
I''m reading the "Uploading a file" section of Agile Web Dev with Rails,
but it''s geared toward saving the file in the database.
Any advice?
Thanks,
Jeff
--
Posted via http://www.ruby-forum.com/.
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture-
driven way of spec-ing or mocking. How the heck to you mock this so
the code at line (2) and (4) work right? I''m still struggling with
mocks but it seems like this can be done. Forgive the naivety of this
question.
1. def change_quantity
2. @line_item = LineItem.find_by_id(params[:id])
3. unless
2006 Jan 06
4
Upload Progress Bar Problems
I''m writing an application where the user will be uploading many images
and user feedback is essential.
I''ve been trying to get the upload progress bar plug-in to work, but
thus far have not had any success.
I''ve downloaded Sean Treadway''s application code from his site
http://sean.treadway.info/demo/upload/ and I followed the steps in his
Upload
2006 Jan 05
4
testing file uploads
Hi all,
I was wondering about the class used when rails receives file uploads.
Sometimes it appears to be a File, and other times it is a StringIO.
Also it has methods such as original_filename that don''t appear to
belong to either of these classes. I ask because I''m trying to work out
how to test my fil upload related models and controllers.
Is there some standardised way of
2006 Aug 15
8
AGAIN: file object treated as string
I am trying to implement the uploading of a file to a remote server
I get error while trying to write the file on the server. The error I
get is the following:
undefined method `rewind'' for #<String:0x2aaaad062eb8>
It seems to be treating my file as a string instead of a File object.
--------- Code is below ------------------
VIEW:
<%=
2006 Dec 31
2
what''s with the response.should_be_xxxx stacktrace?
If I do
get :index
response.should_be_success
I get about 20k of marshalled dumpage that starts like
#<ActionController::TestResponse:0x390443c @body=\"<html><body>You
are being <a href=\"http://test.host/carts/1\">redirected</a>.</body></html>\",
@assigns=[], @redirected_to={:action=>\"show\", :id=>1},
2008 Jun 09
10
Testing file attachment with Paperclip
Does someone have an example on faking a file upload for just ensuring
it gets called, without actually uploading the file to s3.
I thought that stubbing Model.has_attached_file would be enough, but
it doesn''t seem so ...
This is what I did:
Video.stub!( :has_attached_file ).with( :name ).and_return( true )
has_attached_file is from paperclip, it gets mixed to the model.
1)
2006 Sep 05
2
Mongrel and umask for uploaded files
So any files that are uploaded through my form are getting the following mode:
-rw-------
I need them to have:
-rw-r--r--
I''ve tried setting the umask in a script file called set_umask.rb as follows:
File.umask(022)
and then starting mongrel using:
mongrel_rails start -m config/mime.types -S set_umask.rb
but it doesn''t seem to change the mode that the files are created
2011 Aug 04
3
#create tests fail when I add FriendlyId to my model
I am doing controller testing, and I can''t seem to get the create
method test to pass when friendly_id is added to the mix. If I comment
it out of the model, the tests all pass perfectly. The moment I add it
back in, the error looks like this:
1) Error:
test_create_valid(BrandsControllerTest):
FriendlyId::BlankError: FriendlyId::BlankError
2006 May 19
9
Resize uploaded image file without creating temp file?
Hi,
I need to take a single uploaded image file and save three resized
versions of it, a thumbnail, normal and large version. I was planning on
doing this in my model by having an array of geometry strings and looping
through them, each time saving a new image object resized to the correct
geometry. I know that file column does similar stuff, but I would prefer
to have a separate database row
2006 May 29
3
IFRAME based RJS - responds_to_parent
** File uploads with AJAX mojo **
Respond with RJS to your parent window with a form action targeted to
a hidden IFRAME. Handles all the painful situations like scoping
your JavaScript to your parent window generating the script block for
execution and clearing the IFRAME after execution so the back button
doesn''t re-execute the action.
`plugin install