0

我有两个模型:

class MeetingPoint

    include DataMapper::Resource

    belongs_to :profile

    property :id, Serial
    property :lat, String

end

class Profile

    include DataMapper::Resource
    has n, :meeting_points

    property :id, Serial

    property :distance, Text
    property :created_at, DateTime
    property :updated_at, DateTime

end

现在我创建一个表单来编辑配置文件和 meeting_poing:

= form_for @profile do |f| 

    = f.text_field :distance
    = f.fields_for  @profile.meeting_points do |ff|
        = ff.text_field :lat
    = f.submit

但是当我想保存值时,我总是会收到错误:控制器@profile.update(params [:profile])中的“属性'meeting_point'在配置文件中不可访问”

4

1 回答 1

0

我认为有一个插件(dm-accepts_nested_attributes)可以解决这个问题 -

此处讨论的类似问题和更多详细信息

于 2013-05-26T11:04:42.970 回答