Displaying 20 results from an estimated 1000 matches similar to: "rspec and set_table_name?"
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.
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,
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,
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
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/.
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 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 Aug 06
2
assert_difference gives undefined method error in unit tests
Hi there
Am hitting undefined method errors for ''assert_difference'' in my unit
tests under Rails 1.1.4
What could I be missing?
Richard Sandilands
2006 Aug 02
3
Data relationships for e-commerce: users, orders, addresses
Hi there
I''m in the process of developing an e-commerce Rails app but am
getting a little stuck on what models I should be working with on the
order/checkout side of things.
The app requires users to be registered and authenticated to checkout.
So I already have a User model and an Order model (which belongs to a
User). The Order model is largely similar to that used in the Agile
Rails
2006 Jan 18
3
legacy database on remote host
I''m getting this error in webrick then it crashes leaving nothing in the
log.
ruby: symbol lookup error:
/usr/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so: undefined symbol:
mysql_sqlstate
Here is the standard query I would normally write to get the data.
select * from child,parent
where CONCAT(SUBSTRING(child.item_number,1,14,''00'') =
parent.order_number and
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 Jul 21
3
Credit card processing through Australian gateways (eway etc)
Hi there
Has anyone out there embarked on credit card processing in a Rails app
through Australian gateways such as eway?
I''m aware of Payment and ActiveMerchant, but neither support
Australian gateways.
It''s a little beyond me right now to hack these to work with eway.
Any clues would be appreciated here.
Richard Sandilands
2006 Jul 22
3
Extend dynamically a model
Hello,
I''ve a model defined as
class Account < ActiveRecord::Base
end
This maps a mysql table Accounts. I want to be a able to dynamically
change this model. During the life of my app, the table Accounts may
change name, how do I do a set_table_name not within account.rb?
--
Posted via http://www.ruby-forum.com/.
2007 Nov 25
15
Possible Problem with RSpec and
Sorry to be such a pest but I am trying to learn Ruby, Rails and RSpec all
at one go and it is a bit overwhelming. I have previously completed the
depot tutorial in the Agile Web Dev with rails book and now I am trying do
do it again using RSpec.
What I would like to know now is why I am getting a rake failure error at
the end of every spec:models run. Is this the expected behaviour when a
test
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
2006 Jul 25
2
join in legacy DB?
I''ve got a problem with some tables that don''t follow any RAILS
standards. how do I define the join in the model when all three tables
have wacky names?
class Machine < ActiveRecord::Base
set_table_name "tbl_CodeMgmt_Host"
set_primary_key "Id"
end
class Pool < ActiveRecord::Base
set_table_name "tbl_CodeMgmt_Pool"
set_primary_key
2006 Apr 11
1
Foreign Keys
Hi,
My tables are as follows:
"tblusers" - primary key "TblUsersID"
"tblregisteredphones" - primary key "TblRegisteredPhonesID"
- foreign key "intUserID"
My models are as follows:
class Registeredphone < ActiveRecord::Base
set_table_name "tblregisteredphones"
belongs_to :user,
:foreign_key