Created
November 15, 2012 07:41
-
-
Save elico/4077244 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Card < ActiveRecord::Base | |
set_table_name "card" | |
has_many :messages, :class_name => "MsgQueue" | |
end | |
class MsgQueue < ActiveRecord::Base | |
self.table_name = "msg_queue" | |
belongs_to :card | |
belongs_to :templates | |
end | |
irb(main):001:0> msg = Card.first | |
=> #<Card id: 1, passport: nil, first_name: "xxxx", last_name: "yyy", email: "[email protected]", phone: "****", mobile: "***", street: nil, city: nil, zip: nil, active: true, comment: "", created_at: "2012-11-15 07:05:08", updated_at: | |
"2012-11-15 07:05:08"> | |
irb(main):002:0> msg.messages | |
←[1m←[36mMsgQueue Load (1.0ms)←[0m ←[1mSELECT `msg_queue`.* FROM `msg_queue` WHERE `msg_queue`.`card_id` = 1←[0m | |
Mysql2::Error: Unknown column 'msg_queue.card_id' in 'where clause': SELECT `msg_queue`.* FROM `msg_queue` WHERE `msg_queue`.`card_id` = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment