search for: suburbcontroller

Displaying 1 result from an estimated 1 matches for "suburbcontroller".

2006 Aug 14
1
What fields_for really for?
...t; ActiveRecord::Base has_many :districts end === 2 === class District < ActiveRecord::Base belongs_to :region has_many :suburbs end === 3 === class Suburb < ActiveRecord::Base belongs_to :district validates_numericality_of :region_id, :only_integer => true end In edit.rhtml for SuburbController I need to specify region_id. There is no region_id in suburb model so first I added these lines to it: ... class Suburb < ActiveRecord::Base belongs_to :district attr_writer :region_id def region_id district.region_id if district end def region_id_before_type_cast region_id...