Displaying 20 results from an estimated 600 matches similar to: "Testing for multipart form uploads"
2012 Jun 08
1
[Rails 3.2.5] Rails: unit test fixture_path : fixture_file_upload cannot find the file ...
I am trying to perform a test unit, using FactoryGirl
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :article do
.......
photo { fixture_file_upload ''/files/test.jpg'', ''image/jpg'' }
end
end
IN mt test_helper.rb I defined the fixture_path
def fixture_path
File.dirname(__FILE__) + "/fixtures/" #
2011 Oct 16
2
question: ragged array
Hello,
I have a big problem which I’m just not able to solve.
I created the following mean value from the following dataset structure:
Id |value
1 | 2
1 | 3
1 | 4
2 | 2
2 | 1
3 | 5
4 | 3
etc.|etc.
with the command:
mean_rating <- tapply(ratok$value, ratok$project_id , mean,simplify = FALSE)
this gives me a ragged array:
> mean_rating [1]
$`14`
2006 May 01
0
Testing File Upload error
I am trying to build some tests where a file is uploaded and than
processed by file column. Perhaps I am misunderstanding the new
fixture_file_upload that was introduced in 1.1 but I can''t seem to
get it to work correctly. I am trying to run a functional test to
make sure that a redirect is made to the appropriate page from a
create action. I create an issue and the issue can
2014 Feb 18
0
How to Test Multimodel Paperclip attachments?
I'm using Rspec and FactoryGirl to create specs for multimodel paperclip
attachments. From searching other questions, it seems like a single
image attachment is more common.
Car.rb
class Car < ActiveRecord::Base
has_many :uploads, dependent: :destroy
validates :uploads, presence: { message: 'You must upload at least
one image' }
2007 Jul 22
2
Seek brilliant Rails programmer to add one field to acts_as_taggable
I''m on the downhill side of a large project that requires an
additional integer field to be added to the tag.rb in
acts_as_taggable. I feel I have a good understanding of ActiveRecord
and have performed the correct migrations.
(As a short background for those following this thread) when one wants
to add tags to a model they call the ''tag_with'' method that jumps into
2008 Jun 13
2
Rails 2.1.0 - find with :include and missing JOIN in SQL query
Hi,
We''re trying to rewrite veeeery old Rails app that we successfully
managed to move to 1.2.6 and now we''re trying with 2.1.0.
One of the problems is caused by :include in AR.find. Rails 1.2.6
generates totally different SQL query than
2.1.0. Here''s Rails find query and generated SQL queries:
Foo.find(:all, :include => :ticket, :conditions =>
2007 Dec 01
3
Rails 2 problem with compute_public_path
I''m trying to migrate to Rails 2, but keep getting these errors all
over the place:
ActionView::TemplateError: wrong number of arguments (2 for 3)
On line #61 of users/new.rhtml
58: <% if @captcha_error -%><div class="fieldWithErrors"><
% end -%>
59: <table class="signup"><tr>
60: <td
2007 May 06
1
validates_uniqueness_of (with :scope) doesn't seem to work?
I have a master record called ''project'' and a child record called
''agycode''. Obviously, agycode has a project_id FK. I wish to make the
"descr" field unique ONLY within the ''project_id'' ''scope''. Here are the key
pieces of information
Agycode fields (id, project_id, descr)
Here''s the declaration in the
2007 Oct 03
2
Scroll to anchor from RJS
Is there an way to tell the browser to scroll to a certain anchor from
an RJS template?
I''m doing a page update, adding stuff at the bottom and want to
browser to go there after it''s been added.
Thanks,
Helzer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
2006 Jan 16
0
belongs_to with has_and_belongs_to_many
I''m having a problem with belongs_to and has_and_belongs_to_many.
Here''s a brief summary of the models involved:
class Member < ActiveRecord::Base
set_primary_key ''member_id''
has_and_belongs_to_many :projects, :join_table => ''projects__members''
has_many :projects, :foreign_key => ''created_by''
end
class
2007 Sep 22
1
Howto customize deployment with capistrano2
My deployment requires a few extra steps after ''update_code'' and then
again after ''symlink''.
Until I migrated to capistrano2, I had my own deploy_with_migration
task which added these steps.
What would be a recommended approach to accomplish the same using
capistrano2?
Thanks,
Helzer
--~--~---------~--~----~------------~-------~--~----~
You received this
2012 Mar 26
3
render :json not sending any data back ...
[rails 3.2.2]
I perform an ajax call :
...
$.ajax
url: " /backoffice/expenses/rate"
type: "GET"
dataType: "json"
data:
project_id: $(''#project_id'').val()
code: $(this).val()
success: (result) ->
alert result
$(''#expense_price'').val(result)
in
2007 Dec 11
14
Attachment-fu + Story Runner
Hi all,
I''m trying to run a Story Runner integration test that uploads a file
through Attachment-fu.
I''ve tried various ways of specifying the file data, from custom mocks:
class MockFile < Struct.new
(:original_filename, :read, :content_type); end
fdata = MockFile.new "test_upload.txt", "Test Upload", "text/plain"
to
2008 Oct 30
1
Nested Resouces,not getting parent id(project_id) from form
Hi
i am using nested resources,here project having has many relation with
defects.
Main problem here is i am not getting project_id from edit form.What''s a
problem if any one knows please help.
edit.html.erb
<% form_for(@defect,@project) do |f| %>
<%=f.text_field :name%>
<%end%>
routes.rb
map.resources :projects,:has_many=>:defects
map.resources :defects
2007 Nov 09
9
fixture_file_upload and edge rspec?
Hi all,
I had some specs that were using fixture_file_upload that were
passing just fine. Then I froze edge rails to get some 2.0
functionality, then a I upgraded to trunk rspec to deal with
uninitialized constant ActionView::Helpers::JavaScriptMacrosHelper
After a couple other of tribulations, I have now gotten down to just
a couple of not passing specs, all using the fixture_file_upload.
2007 Apr 25
2
form_remote_for, reloaded
Hi,
being relativly new to RoR, I''m having a problem which I found described
in this forum and somewhere else - but with no solution. I know, that it
may be bad to mix table and form tags, but the first solution of an in
place editing within a table looked nice:
Version using form_for:
<tr>
<%form_for :time_record, :url => { :action => "add_time_record" } do
2007 Nov 02
5
RSpec, RESTful nested routes and :path_prefix
Dear list,
In the app we are making we have a rout something like this:
map.resources :projects do |projects|
projects.resources :pages, :controller
=>"Wiki::Pages", :path_prefix => "/projects/:project_id/
wiki", :name_prefix => "project_wiki_"
end
But I can''t get RSpec(I''m very new to it) to accept this. It keeps
throwing errors:
2006 Jan 04
0
Re: DB Modelling the Rails way - solution by Chris Hall
Hi Chris,
Yesterday you kindly submitted an answer to my question on modelling
many to many relationships. I''ve briefly tried the proposed solution but
so far with no luck. Before I get too involved - I''d like to know if
mapping three way :join_tables is "legal" in a Rails sense. I only ask
since you put (untested) in your mail and I can''t find any docs on
2006 Dec 27
0
HABTM Checkboxes - Adding/Updating Users to a Project
Hello all,
I''m trying to create a HABTM checkbox action that adds/updates ''users''
to a ''project''.
I have the following laid out.
---------------------
TABLES
---------------------
create_table "assignments", :id => false, :force => true do |t|
t.column "project_id", :integer, :default => 0, :null => false
2006 Apr 16
2
Making requests in order
Hello all,
This is an interesting problem I have been working on. What I have is a
little multiuser project request tracking application. What happens is
that I log in and create projects and assign people to the projects.
Each project has steps associated with it, and the steps need to be done
in a certain order. Now, I have to request that the assigned person
perform each of the steps, and