Displaying 2 results from an estimated 2 matches for "foreign_type".
2006 Apr 23
0
Severe STI, HABTM with Attributes and 1.1
...reate_table "nodes_to_nodes", :id => true, :primary_key => "n2n_id",
:force => true do |t|
t.column :node_id, :integer, :default => 0, :null => false
t.column :node_fk_id, :integer, :default => 0, :null => false
t.column :position, :integer
t.column :foreign_type, :string
end
class NodesToNodes < ActiveRecord::Base
set_primary_key :c2c_id
acts_as_list :scope => :node
end
So basically I could have all sorts of Node types that used STI off
the original Node table. And the if Foo < Node and Bar < Node I could
set in Foo''s model that...
2006 Jun 13
6
Dead horse: validates_associated
Regarding validates_associated...
Let''s say I have:
article belongs_to author
But for whatever reason, I want an article to also be written
anonymously and therefore not require an author. Then I have:
Article:
belongs_to :author
validates_associated :author
But I DON''T have validates_presence_of. What I want to do is validate
that an author is valid --if it is