similar to: Error loading fixtures with classes that set_table_name

Displaying 20 results from an estimated 2000 matches similar to: "Error loading fixtures with classes that set_table_name"

2008 Jun 23
0
Error loading fixtures for classes that set_table_name
Hi all, I just hit a big wall involving a legacy database. I''ve got an active record class called "School" that uses "set_table_name ''old_school''" to map to a legacy database table: class School < ActiveRecord::Base set_table_name ''old_school'' end It works great, until I''m testing and I want to use fixtures.
2007 Jun 25
0
Problem with RSpec in legacy databases
Hello. I am a newbie with BDD. I am trying to use RSpec with some legacy tables and I use the set_table_name method in the models. The name of the table and the class doesn´t match. It seems that there is no problem to load the fixture in Test::Unit, I will use the method set_fixture_class before loading fixtures, and I will get to the data in the fixture without problems. But this doesn´t seem
2006 Apr 01
1
set_table_name and fixtures
Hello, I''ve encountered a fixtures really frustrating bug : model, YAML file and db table names must be the same because of the fixture library ignoring the set_table_name provided in the model. Is there anything to do ? Thanks -- Posted via http://www.ruby-forum.com/.
2010 Dec 12
5
Fixtures and unit tests - no such file to load
Hello all, I''m having some issues with my test fixtures and unit tests and am hoping somebody has an idea about how to fix it. Background: I have a table in my legacy database called tp_approval_step. For this table I have a fixture called tp_approval_step.yml I have a model called ApprovalProcessStep that uses set_table_name ''tp_approval_step'' In my test file,
2007 Jan 14
2
rspec and set_table_name?
Hi there I have a Value class in my Rails app; however ''values'' is a reserved word in MySQL so in my value.rb file, I''ve declared set_table_name as ''vals''. However, in setting up my specs for this model, I''m hitting errors that seem to be resulting from rspec not seeing the set_table_name declaration in my model file. For instance,
2006 Mar 25
4
dynamic set_table_name for achives
How can I pass something to set_table_name so that I can switch tables on the fly for accessing archive data? If I could access sessions inside a model I would do something like: if @session[:current_period] set_table_name "statistics_" + @session[:archive_year] else set_table_name "statistics_" + Date.now.year end But since I cannot access the session from within a
2009 Mar 18
1
set_table_name woes, fragmented domain class
Hi all, I''m running Rails on top of a Mongrel cluster. I have several model classes that are going to have so many records it is not feasible to keep them all in the same table. So I''ve split out the records into many different tables, each with its own suffix which corresponds to the id of the model to which all records in that particular table belong. For example,
2006 Jul 25
0
including database in set_table_name
Hi, Is there any reason why it would be a bad idea to include the database name, ie: set_table_name ''database.tablename'' in my models? We have legacy tables spread across several databases in MySQL and we use separate base classes for each which have their own establish_connection''s to ensure they connect to the correct database. The problem with this is that
2009 Feb 25
1
Problem with set_table_name
Dear friends, I ran the following in my console.Assume I already have the postgresql connection . >> class D < ActiveRecord::Base >> end => nil >> D.set_table_name "users" => nil >> D.column_names => ["id", "name", "fname", "lname", "password", "addr1", "addr2",
2006 Mar 02
1
Fixture accessors broken for polymorphism, in need of redesign
Ticket 4052 (http://dev.rubyonrails.org/ticket/4052) just came through trac, which introduces the need for a better way to access fixtures. I believe the basic problem is the same as 3935 (http://dev.rubyonrails.org/ticket/3935) in that the accessor method which is constructed by the fixture call can''t infer the class name from the table name. The band-aid in 3935 was to allow you to
2006 May 15
8
set_table_name and self.table_name
I have some legacy tables that I used set_table_name on, I''m attempting to write a method that will get key value from a sequence table and then update it and return a value. I''m hoping to put this in the base ActiveRecord method so I would like to reference the table name with self.table_name or something... class Contacts < ActiveRecord::Base set_table_name
2005 Aug 23
0
Fixtures: pluraly bitten
With my functional tests (on PgSQL) I get strange errors like this 1) Error: test_create(AufgabeControllerTest): ActiveRecord::StatementInvalid: ERROR: duplicate key violates unique constraint "aufgaben_pkey" Tracking this down, I found that sequences are only reset for some of the tables I''m using. The reason? Inconsistent singularization. I won''t go so far as
2007 Sep 10
2
Removing an AR class definition, for testing plugins
I''m writing an acts_as_* plugin and am trying to BDD it. Ideally my specs would look like: describe ActsAsCloneable, " basic cloning" do load_example_classes School.class_eval do acts_as_cloneable end before(:each) do @old_school = School.create! :name => "Baylake Pines", :city => "Virginia Beach", :guid => "abc123"
2006 May 23
2
Putting fixtures into subdirectories
I want to organize my fixtures just like the namespace of my models. So for example if I have a model Company::Employee I''d like the fixture to be in fixtures/company/employees.yml. However, I can''t figure out how to specify the path of the fixture file. If I do: fixtures :employees in my unit test it can''t find the fixture file. Any suggestions? Thanks, Todd
2006 Mar 06
4
Change to set_fixture_class
So, I sat down to use set_fixture_class, and it bombed on the first thing I tried: set_fixture_class :content_drafts => "Article::Draft" I made a quick patch, and I''d appreciate a quick run through your tests to make sure it doesn''t disturb anything: http://dev.rubyonrails.org/ticket/4095 As I was typing this, I realized that the string gives us no benefits. I
2011 Aug 17
7
autoloading LoadError: Expected known_ip.rb to define KnownIp
Hello, i have a problem with autoloading model classes. I have had similar problems before when a file''s name in Rails'' opinion did not match with the name of the class defined inside, but eventually everything worked, so i didn''t look into details. This time the problem comes from running Unit Tests and does not want to go away. I have a model class KnownIP defined in
2006 Jun 28
2
undefined method `use_transactional_fixtures=''
Folks, I checked my test_helper.rb and it has self.use_transactional_fixtures = true My code was generated with 1.1.2 and I''m using 1.1.3 right now after but the error persists. I googled for this issue and it appears that a require is missing or something like that. I can''t figure it out, please help! /opt/local/bin/ruby -Ilib:test
2006 Aug 17
6
NameError in AdminController#index building scaffold
I''m a pretty big newbie with ROR, but when following a tutorial I encounter an ugly error when building a scaffold. Here is my environment Dev system: - Windows XP - java version "1.5.0_06" - MySQL java version "1.5.0_06" - Ruby 1.8.4 - Ruby Gems 0.9.0 - Gem install mysql Successfully installed mysql-2.7.1-mswin32 Installing ri documentation for
2006 Feb 08
1
functional test problem
I am trying to write a test for my delete method. I find a User in the db by its id, do the delete action, then I want to see if it is still in the db. How do I check that the User IS Deleted without causing errors? ** My Test ******************************** def test_delete_user login user = User.find(2) post :delete_user, {:id => user.id} assert_equal "User
2006 Jul 24
1
All functional tests fail with RoutingError
All, I''m using InstantRails 1.0 on Windows XP and all my functional (controller) tests fail with ActionController::RoutingError, although the actions work OK through a web server/browser. Here''s an example of an error: 1) Error: test_create(AdminControllerTest): ActionController::RoutingError: No url can be generated for the hash {:controlle r=>"admin",