Displaying 3 results from an estimated 3 matches for "pgm_visits".
2006 Mar 04
5
has_many and belongs_to example?
Hi!
If i have 2 tables i.e. product and images and product has_many images,
image belongs_to product - how to create _form.rhtml, new/create and
edit/update methods in product controller, so in a single form i can add
one product and MANY (let''s assume for now that this number is fixed)
images for this product?
Pleeeeease help me :)
--
Posted via http://www.ruby-forum.com/.
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...
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/Associ...