Displaying 20 results from an estimated 1100 matches similar to: "set_table_name woes, fragmented domain class"
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
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 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/.
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 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 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/.
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
2005 Jun 07
8
[PATCH] add dom0 vcpu hotplug control
This patch adds new control messages for vcpu hotplug events. Via the
xm vcpu_hotplug sub-program, VCPUS in domains can be enabled/disabled
when CONFIG_HOTPLUG_CPU is enabled in the target domain''s kernel.
Currently there is nothing that tracks whether a VCPU is up or down.
My previous [1]patch added a new per-VCPU flag (VCPUF_down) which could
be used to keep track of which VCPUS are
2006 Jul 22
3
Connection refused - connect(2)
Dear all,
Please help me in this regards,
I am using models to access LegacySchemas using
set_table_name and set_primary_key...
[code for model]
class CdDetails < ActiveRecord::Base
def self.find_data
set_table_name ''cd_details''
set_primary_key ''cd_label''
find (:first,
:select => "cd_label")
end
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
2008 Jan 23
1
Making Parents object attributes available
Hello,
I have a class Person
class Persoon < ActiveRecord::Base
set_table_name "Persoon"
set_primary_key "p_persoon"
has_many :adres, :class_name => "Adres"
composed_of :name, :class_name => Name, :mapping => [ [:naam,:naam],
[:voornaam,:voornaam], [:voornaam2,:voornaam2],
[:persnickname,:persnickname], [:perssortname,:perssortname] ]
def
2009 Mar 17
11
Refactoring module
Dear all
Please see the following module, In module SX3 SX4 and SX5 have similar
class Tasklist, but inherit from different class.
I will use the following code to connect to different data sources
RemoteSX3Model.establish_connection sx3_hash
RemoteSX4Model.establish_connection sx4_hash
RemoteSX5Model.establish_connection sx5_hash
How can I refactor my code in module to look simpler? Thank you
2005 Nov 30
3
Downcasing Legacy Table Column Names
I''m looking for the simplest way to *automatically* downcase the
attribute names of Models mapped to legacy tables that use upper
case. eg:
class Workorder < ActiveRecord::Base
set_table_name "WORKORDER"
end
which has "NAME" as an attribute can use "name" as an attribute.
currently:
workorder = Workorder.find(1)
workorder.NAME # =>
2006 Jan 17
15
legacy database and finder_sql nightmare!
This is my first rails app with a legacy database and I''m having a
terrible time getting the models set up correctly. I have an order
table that has a primary field named order_number. I have a name table
with a primary of item_number. These two tables are liked by the
item_number and the order_number, but not as you might think. If the
order_number is 2500, then each entry in
2006 Mar 26
4
A unit test that should pass
Hi, I wonder why this unit test fails.
The model :
class Article < ActiveRecord::Base
set_table_name "publish_articles"
belongs_to :category
validates_presence_of :title, :excerpt
#snip
end
The test :
def test_validate
@article.title = nil
@article.excerpt = nil
assert !@article.save
assert_equal 2, !@article.errors.count
end
!@article.errors.count returns
2006 Mar 24
6
Microsoft SQL Server has me stumped
I''m tinkering around with an old legacy table in SQL Server 2000.
Ruby 1.8.4, most recent ADO.rb file from RubyForge, Rails 1.0
Here''s the model:
class InventoryItem < ActiveRecord::Base
set_table_name "[_SMDBA_].[_INVENTOR_]"
set_primary_key "sequence"
end
Everything works fine. I can retrieve records without issue.
However, when create a new