Displaying 2 results from an estimated 2 matches for "pgmvisit".
Did you mean:
pgm_visits
2006 Mar 13
2
relationship woes
I have two tables:
class PgmUpdate < ActiveRecord::Base
has_many :pgm_visits, :foreign_key => ''pgm_update_fk''
...
and
class PgmVisit < ActiveRecord::Base
belongs_to :pgm_update, :foreign_key =>
''pgm_update_fk'', :dependent => true
...
According to the has_many docs (http://api.rubyonrails.org/classes/
ActiveRecord/Associations/ClassMethods.html#M000471)
collection<<(object, ?) - adds one or...
2006 Mar 14
1
Where to validate?
class PgmUpdate < ActiveRecord::Base
has_many :pgm_visits
...
class PgmVisit < ActiveRecord::Base
belongs_to :pgm_update
...
I am trying to make sure that none of the visits in PgmUpdate overlap
start and end dates. Should this validation exist in PgmUpdate or the
controller? It seems natural to put them in PgmUpdate, but I must
force the relationship togeth...