我收到此错误'未经许可的参数:图片'在嵌套参数中

时间:2016-07-31 09:38:02

标签: ruby-on-rails nested-attributes

这是我的 profiles_controller.rb

Posts.update({_id: postIdToUpdate}, {
    $push: {
        "comments": {
             "comment_id": lengthComments + 1,
             "comment": "My comment",
             "user_id": Meteor.userId(),
        }
    }
});

profile.rb 具有来自 image.rb 的嵌套属性

 def create

 @profile = current_user.build_profile(profile_params)

  if @profile.save
  else
    render :new 
  end
 end
 end

这是 profile.rb

  params.require(:profile).permit(:first_name, :last_name, :phone_no, image_attributes: [:id,:image,:imageable_id,:imageable_type])

这是 image.rb

 class Profile < ActiveRecord::Base
 belongs_to :user
 has_one :image , :as => :imageable
 accepts_nested_attributes_for :image
 end

来自 profile.rb 模型的 _form.html.erb

  class Image < ActiveRecord::Base
  belongs_to :imageable, polymorphic: true
  mount_uploader :image, ImageUploader
   end

1 个答案:

答案 0 :(得分:0)

// comp :: (b -> c) -> (a -> b) -> (a -> c)

// comp2 :: ??
const comp2 = comp (comp) (comp)

// initial type
(b -> c) -> (a -> b) -> (a -> c)

// apply to comp once ... ???
[(b -> c) -> (a -> b) -> (a -> c)] -> (a -> b) -> (a -> c)

// apply the second time ... ???
[(b -> c) -> (a -> b) -> (a -> c)] -> [(b -> c) -> (a -> b) -> (a -> c)] -> (a -> c)

// no... this can't be right