我有以下模型,成员和地图,设置如下:
class Member < ActiveRecord::Base ... has_one :map,:dependent => :destroy ... class Map < ActiveRecord::Base belongs_to :member
我的路线设置为:
resources :members do resources :maps end
我的地图控制器是:
def new @map = Map.new end def create @map = current_member.map.new(params[:map]) if @map.save.....