Displaying 20 results from an estimated 70000 matches similar to: "Loading fixtures and counter_cache"
2008 Jun 19
0
Error loading fixtures with 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.
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 May 21
2
Rails'' fixtures suck! But what about something like this?
Sorry about the very long email, but this is a hairy topic that''s been
annoying me for some time and I decided to try to do something about.
Also, if you got this twice, I apologize too, but it didn''t seem to
have successfully gone out the first time.
Background:
----------
I''ve been dealing with Rails for about a year and a half now. I''ve
been using
2007 Nov 05
0
loading fixtures into oracle
Any idea why this fixture would fail to load any data?
<%
%w( Admin Pharmacist PI/Co-PI Research\ Nurse ).each { |g|
Group.create( :name => g ) }
%>
It works perfectly in irb but when I do rake db:fixtures:load I get no
data, no errors, and no error logs.
I realize my fixture doesn''t look like your typical run-of-the-mill
fixture but it''s that way because I''m
2006 Nov 23
0
TypeError on loading fixtures for integration tests
Functional tests properly load fixtures, but my integration test
chokes:
# def self.create_fixtures(fixtures_directory, table_names,
class_names = {})
# puts("fixtures dir: "+(fixtures_directory.nil? ? "nil" :
fixtures_directory))
It''s only nil for my integration tests. I''m on rails edge. Does anyone
know what I''m doing wrong here?
1) Error:
2007 Feb 06
0
Integration testing without loading fixtures
Hi,
Is there a way to run rake test:integration without having it fire of
db:test:prepare? I''d like to setup the test database without using
fixtures.
I ran the integration script manually which is fine, but would prefer
to use the rake task. It seems like I get more output from rake, but I
might be wrong.
Thanks,
Fredrik
--~--~---------~--~----~------------~-------~--~----~
You
2005 Mar 01
0
acts_as_tree counter_cache
Hi List,
I''m new to and hot on RoR.
And I have a question regarding acts_as_tree and counter_cache.
What methods actually update the counter_cache column?
I''ve only really started the app so i''ve just got it set up so that I
can select the parent node (from a list of nodes that exclude all
descendants of the current node) with a radio buttoned list named and
valued
2006 Feb 27
0
Better counter_caches
Hey everybody,
Rails currently offers ''belongs_to :counter_cache'', which is a very
basic replacement for count triggers:
":counter_cache - caches the number of belonging objects on the
associate class through use of increment_counter and decrement_counter.
The counter cache is incremented when an object of this class is created
and decremented when it?s destroyed. This
2007 Apr 03
1
functional test, fixtures should load by myself ?
rails version: 1.2.3
ruby version: 1.8.5
----
functional test, fixtures should load by myself ?
class FooControllerTest::Test::Unit::TestCase
fixtures :foo, :bar
def setup
setup_with_fixtures # <--- must call this ?
end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Feb 03
2
acts_as_tree counter_cache behavior is different than API docs
Before I file a ticket, I''ll query ya''ll about this:
The API docs for acts_as_tree''s counter_cache is to create a database column
called "children_count" to hold the counter_cache. I have enabled this
option in my model. While writing tests I wrote a test for creating children
from the a parent:
message = @forum_message["parent"].find
child =
2008 Nov 05
1
Constants in models are initialized before fixtures are loaded?
Hi,
here''s simplified code from the model:
class Foo < AR::Base
FIRST = Foo.first.id
end
The problem is that when testing I get well known error: "Called id
for nil...". I guess that this constant is initialized before the
fixtures are loaded.
Is there any way to fix it?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are
2006 Jul 11
1
counter_cache, has_many and belongs_to
I am a bit confused about counter_cache here. The API docs
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
say that only the belongs_to association can take the :counter_cache
option. When I try to use it on a has_many I get an "unknown key(s):
counter_cache" error.
Why would this be the case? belongs_to means that this model has a
field with an id
2006 Jun 08
2
counter_cache is not looking for children_count with acts_as_tree
Hi there, the acts_as_tree API says that I can set a counter cache and
that it will automatically increment the "children_count" column. I
did that but when I create a new page it asks for a "pages_count"
column instead.
Here is the relevant part of page.rb model:
class Page < ActiveRecord::Base
acts_as_tree :order => :position, :counter_cache => true
2007 Jun 13
2
Delete the fixtures on a functionnal test
Hi,
Since couple a day, I block with the delete of my fixtures in my
functionnals test. In my controller, I need test a redirect if there
are no value.
But i load my fixtures in start of my test and in a specific test I
want delete all. Only in this method, not in other method. In API, I
discover the method delete_existing_fixtures, who seem the good
practice, but I can''t find how use
2006 Apr 12
0
counter_cache and updates
I''m trying to figure out how to use counter_cache.
I''ve got Clients that have many Profiles. And I got things working so that
when I add a new Profile, the profiles_count gets updated.
profile = client.profiles.new(params[:profile])
profile.save
However, I''m stuck trying to figure out how to deal with UPDATING a profile
(moving it to a different Client). If I change
2005 Dec 14
0
counter_cache not updating
Hi
I'm using those 2 models:
class Topic < ActiveRecord::Base
has_many :articles, :order => :rank
end
class Article < ActiveRecord::Base
belongs_to :topic, :counter_cache => true
end
The "counter_cache" column in the "topics" table does increase when
adding a new article, but it does not update when updating article's
topic or when deleting the
2007 Sep 05
2
after_create callback called twice in test env when using fixtures
All,
I''ve been trying to figure out a strange bug in one of my applications
that I think I''ve narrowed down to a problem with rails fixtures. It
seems as though the after_create callback is being run twice when I
save a record. This is only happening a) in the test environment, and
b) when there is a fixture file for that table.
The test below only prints "Doing
2008 Feb 07
4
rspec fixtures stay in the test db - is this right?
I have some fixtures set up to put a few records in some of my tables.
In some of my rspec describe blocks, i''m *not* calling the fixtures, and
expecting the tables to be empty. But they''re not - the fixture data is
in there.
Am i using fixtures wrongly? I thought that the db was wiped at the
start of every test and the fixtures were only added if asked for. Is
that not the
2006 Dec 08
0
Dump plugin models to fixtures?
So I''ve got several plugins running on a site I''m developing. I''m
dumping my own models to fixtures using db:fixtures:dump, but models
that are part of plugins like authorization/acts_as_authenticated aren''t
accessible. How can I dump this data to fixtures to?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You
2007 Jun 03
0
fixtures outside of rails
Hi,
Is anyone using fixtures in unit tests for applications using
ActiveRecord outside of rails? I found an example to do this from some
old threads. They cite as an example:
http://opensvn.csie.org/ezra/rails/ez_where_two/test/test_helper.rb
However, I copied this exactly and can still not get fixtures to work by
putting ''fixtures :my_model'' at the top of my test class. They