similar to: Testing fails with fixtures not when invoked directly

Displaying 20 results from an estimated 300 matches similar to: "Testing fails with fixtures not when invoked directly"

2006 Aug 14
1
Rest, routes, path_prefix and default params
I am trying to use routes with default params to have routes ''/mycompany/departments'' and ''/companies/1/departments'' mean the same thing (both restful routes). When I set up the files as below, I get an error of ''Couldn''t find Company without an ID'' and my log file shows the following .. Processing DepartmentsController#index (for
2006 Jul 10
3
Problem with migrations
I am trying to start my first project after going though the Depot application in prog prog''s book. For some reason one of my migrations keeps bombing. I just try to setup a couple tables with some default information and even with changing the name of the second table and other minor tweaks it just does not work. I am connected to the db, the first table does get filled out. Any help
2010 Oct 02
6
Can't stop webrick with ctrl-c or ctrl-d on linux host
Hi All I have setup a new dev system running LinuxMint 9 (Ubuntu 10.4). Running ruby 1.9.2, rails 3.0, RVM etc. One issue I have run into is that I can''t stop webrick with ctrl+c or ctrl+d and killing the terminal always leaves a stranded ruby process. Has anybody else run into this? Btw, webrick gets started by running "rails s" in. Also, ctrl+c works fine to stop a
2006 May 19
1
ActiveRecord: Minor saving problem
This is probably a very stupid error on my side, but I am doing my first steps now and I don''t see what is wrong. I have companies and I have users. A user can create a company. When the user does he''s automatically a member of the company. A company should be able to have multiple users off course so every member of a company can add other users who don''t have a
2007 Jan 24
2
A spec where interaction-based testing breaks down... (at least for now)
Here are the specs: context "Finding all the stylesheets available to a company" do setup do @mock_company = mock("company") @mock_company.stub!(:to_param).and_return "1" Stylesheet.stub!(:find) end def do_find Stylesheet.find_available_to @mock_company end specify "should convert the company into a parameter" do
2009 Mar 17
1
Route failure with Rails2.3 and rspec1.2
Hello all, I have a spec for a route that used to pass under Rails 2.2.2 and rspec 1.1.12, but can?t figure out what is wrong since I updated. Here is the assertion: route_for( { :controller => ''purchase_orders'', :action => ''update'', :company_id => "32", :id
2006 Mar 30
6
MS SQL query strangeness for ActiveRecord in Rails
Hi, I am currently trying to move my rubyonrails app from Linux to Windows server utilizing MS SQL instead of MySQL due to "business" reason. All my listing screen utilize a drop down list in each column to allow user to "filter" the listing based upon the value chosen from the drop down list. In the controller, I used find() method but with customized parameters such as
2006 May 23
0
RJS replace adding multiple inputs
Hi, I have a classic problem. I want to replace a hidden field inside a form with a hidden field with some value when a link_to_remote is pressed. In the link''s action rjs, I''m doing the following: Assume my form has the following field already <%= hidden_field(''client'', ''company_id'') $> So I have a bunch of companies in a list with
2005 Sep 02
7
Form to update two tables
Hello there, this is probably a very simple problem but I''m stuck. I''m following the Login generator tutorial from rubyonrails. It''s all worked fine so far. But I want to add a bit more functionality so that when a user signs up in addition to chosing a login name and password they type in a company name which is added to a seperate table called COMPANIES. The id
2006 Jan 03
4
Would someone like to tell me why this code will not solve my problem? (it''s short)
I am building an invoicing system but cannot use the auto_increment field to determine the invoice number (because they are running 3 different companies off the one system. I need to find the last invoice number from any given company and then add 1 to it to get the next invoice number. BUT, there is a unique case on the very first invoice produced because there is no earlier invoice
2005 Oct 26
1
Re: collection_select question about selected_value
Paul Welty wrote: > collection_select(:client, :company_id, @companies, :id, :name, { > :selected_value => 2 , :prompt => "Please select a company..." }) > > Returns a functioning SELECT element, but it won¹t select the second item. > (BTW, using the selected_value as a string doesn¹t work either) > > Am I doing something wrong, or is this impossible? >
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All, I am new to ROR, and can''t seem to get HABTM to cooperate entirely... however I might be abusing it! Before I try a different strategy I thought I''d ask here and see if I''m missing something simple. So say Projects and Companies are related. Projects can have multiple Companies, and Companies can be on multiple Projects. But, the same Company can also
2005 Aug 19
2
data validation
I''m trying validate date before they''re stored into the DB, but it seems, validation doesn''t work.. my model looks like this: class Company < ActiveRecord::Base has_many :contacts, :foreign_key =>''company_id'' has_and_belongs_to_many :categories, :join_table => ''company_to_category'', :foreign_key =>
2005 Dec 22
3
foreign_key setting ignored
I''m having a spot of bother creating a ''has_many'' relationship between two legacy database tables. The relationship is ''company'' table has many linked records in the ''contact'' table. Iv''e used ''generate scaffold'' on these tables and everything is fine. I then decided to define the relationship in the
2005 Dec 31
7
Dynamic form? Not really!
Hi guru''s out there, Im happilly coding my first rails app, and all goes well. I find myself manually coding in a particular field all the time (company_id), that relates the contact to a company. The total coding of this form seems somewhat much. Could somebody tell me what Rails power I''m possibly missing and stuborn as I am trying to do myself? I was wondering if the
2008 Jan 03
0
Strange problem
I use backgroundrb for many long tasks in my system, but I''m having issues with one in particular. Two large tasks for me are importing people and updating companies. def import_contacts(args = nil) thread_pool.defer(args) do |job_id| begin job = ImportJob.find(job_id) job.process_job rescue => err logger.error "MscWorker#import_contacts
2006 Jun 26
0
How to limit access to model objects based on role?
Hi all, I want to limit access to model objects based on the role of the logged in user. It seemed the most blunt way of doing this would be make copies of each controller which accessed the models and use one of the access control systems out there to limit access to the controllers. However, with 9 different controllers this seems like a terrible choice. Here''s what I''ve
2008 Jan 03
1
Memory leak and long process problem
I use backgroundrb for many long tasks in my system, but I''m having issues with one in particular. Two large tasks for me are importing people and updating companies. def import_contacts(args = nil) thread_pool.defer(args) do |job_id| begin job = ImportJob.find(job_id) job.process_job rescue => err logger.error "MscWorker#import_contacts
2007 Apr 04
2
[PLUGIN] ArPaginator - Allows you to easily paginate over any existing AR queries.
The built-in Rails pagination is fairly limited...you pass in the model name, and optionally some conditions, and it generates a paginated query for you. This gets to be very bad if you''ve got any custom queries. class Company < ActiveRecord::Base def complete_videos Video.find :all, :conditions => "company_id=#{id} AND status=''complete''", :order
2012 Nov 03
0
ids writer fields for HABTM relationship.
Hello forum readers, Let''s say i have two models: Person and Role (i replicated the problem with Post & Tag as well, as i thought the problem was linked to some application-specific rights problem, but it wasn''t). In Person, attr_accessible role_ids is declared, so it accepts an array of Role ids as an argument when creating / updating. If i fire up the rails console and