similar to: Magic multi connections with association problem

Displaying 20 results from an estimated 2000 matches similar to: "Magic multi connections with association problem"

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
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
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
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
2010 Aug 19
1
Composite primary keys and :joins=>
I have a legacy db with the following simplified structure: Table-A: type_key, code_key, name, ... # PKs are type_key and code_key, there is no id col and I cannot alter this db Table-B: # each row has only the code as a foreign_key, the type_key is hard-coded to "FOOKEY" an_id, code, ... Models: class TableB < AR::Base set_table_name ''table_b''
2007 Aug 11
0
Object herency problems
MOdel Why when i put: Member.find(params[:id]).genealogy, it tells: undefined method `genealogy'' for #<Matrix:0x4682280> class Member < ActiveRecord::Base set_primary_key :userid has_many :matrix, :foreign_key => :userid has_many :matrix, :foreign_key => :parent def genealogy result = matrix.clone matrix.each do |m| m.children.each do |c|
2011 Sep 08
1
Magic Multi Connections gem + Rails 3.1
Hello, Like in topic, did anyone tried to run this gem under 3.1? I''m getting error that mirror_db_connection is not valid key: ArgumentError: Unknown key: mirror_db_connection from /Users/nopik/.rvm/gems/ruby-1.9.2-p180@christmas/gems/ activesupport-3.1.0/lib/active_support/core_ext/hash/keys.rb:44:in `block in assert_valid_keys'' from
2006 Feb 14
6
[newb] Find vs Find :all question
I''m playing out with writing an online store. So far it has accounts, addressbooks, and orders, and those 3 are tied together with an customer ID. I also have orderDetails, which are associated to the order via an order number. See models below... When I do the following I can access the orderDetails information just fine: @order = Order.find(params[:id]) # i pass it a customer
2006 Jul 03
9
Migrations from Mysql to Oracle. PLS HELP!
Hi all, I''m using Rails/Mysql as development platform. the production server is under Rails/Oracle. Right now, i''m trying to install my application under the production server, the connection to orcale is fine via Rails, but i have a weird problem. example : here is a extract from my db scheme : Table User :_____________ id_user | first_name |
2005 Oct 05
0
has_and_belongs_to_many on legacy DB
I am working with mapping ActiveRecord onto a legacy database. All is going well (using set_table_name, set_primary_key, etc), but I can''t get my many<=>many relationships to work. My contrived example of the situation: Student has_and_belongs_to_many Teachers. This is mapped via table student2teacher where the foreign keys are studentId and teacherId. The primary key in Student
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 Jun 14
0
Mssql Multiple Database Access Error
Hi All, I am having a problem to access multiple databases with mssql I am running Ruby 1.8.4 and Rails 1.1 on Windows 2000 Advanced Server. I am simply trying to integrate the application I wrote before for Oracle to Mssql. The application works perfectly with Oracle with the installed driver OCI8. The app retrives data based on a search criteria from those databases. I followed the directions
2006 Mar 14
4
has_one
I''ve got an order model that stores order data. One piece of data is a credit card type, which is a digit 1,2 or 3. I have a cardType model that has an id, shortName and LongName for the credit card merchant (visa, mastercard, amex). I want to be able to say: order.cardType.shortName, but can''t seem to get has_one working. It works with has_many and a finder_sql statement on
2006 Oct 14
2
issues with validates_associated not throwing error
Hello all I''m having an issue with ruby on rails, and it not throwing an error where it should. I have a class ''clientpool'' that is: class Clientpool < ActiveRecord::Base set_table_name "clientpool" set_primary_key "id" belongs_to :clients, :foreign_key => "cliname" validates_presence_of :cliname validates_associated :client end
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 Feb 28
3
[AR] #{id} namespace visibility used in finder_sql
Dears, [Rails 1.0.0] I''m working with a legacy schema, and around my 20+ models i''ve used some AR constructs. They are based on a finder_sql doing some dirty sql and using #{id} from the ''pivot'' model for extracting data in other tables. like : class Division < ActiveRecord::Base set_table_name "legacy_division" set_primary_key
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 Dec 19
0
has_one mapping with arbitrary right and left hand side keys
I have two tables: table_1: tab1_id, other_id table_2: id, tab2_id, something_else I would like to specify a has_one mapping from table_1 to table_2 but specifying that the join is based on (table_2.tab2_id = table_1.other_id). I am half way there with: class Table1 < ActiveRecord::Base set_table_name "table_1" set_primary_key "tab1_id" has_one :Table2, :class_name
2005 Nov 23
0
Another CTI question
I''ve asked some CTI questions before and I have another one based on my migration progress. These are two condensed tables (the actuals being bigger): Content +-------------+ | id | | title | | description | | etc..... | +-------------+ ContentJob +--------------+ | content_id | | location | | date_expired | | etc..... | +--------------+ The above is
2006 Mar 03
0
AR::Base.pluralize_table_names doesnt work with scaffold generator, right?
Hi! The script/generator scaffold for models doesnt respect (source in) this config/environment.rb setup, right? Because I can put in there ActiveRecord::Base.pluralize_table_names = false but when I run a command like ruby script/generate scaffold model Something then it throws an error saying that my database scheme doesnt have a Something. However there is a table called something. If I