Hi Richard;
I use set_table_name too.
Here is my set-up.
product.rb
class Product < ActiveRecord::Base
set_table_name "cart_products"
end
product_spec.rb
context "A product with fixtures loaded" do
set_fixture_class :cart_products => ''Product''
fixtures :cart_products
end
Your fixtures should be the same name as you table, so in my case
cart_products.
HTH,
Matta
Richard Sandilands did write the following on 14/01/2007 1:51
PM:> 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, rspec is throwing a MySQL error as it is attempting to
> delete records from a table named ''values'' which of
course does not
> exist - the table is ''vals'' but the model is Value.
>
> Is this an issue with rspec? If so, is there a way around this? I
> want to keep using rspec and am prepared to rename my class so as to
> not need the set_table_name declaration but want to be clear that
> this is the source of the problem.
>
> Any clues would be appreciated.
>
> Richard
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
> .
>
--
Matt Allen
iseekgolf.com
1300 663 813