I am integrating Cocoon to add multiple attachment with my property object.
But when I am creating new property record, I am getting ArgumentError: wrong number of arguments (2 for 1)
error
= form_for @property, remote: true, authenticity_token: true, html: { class: "form-horizontal", multipart: true } do |f|
.links
= link_to_add_association 'Add', f, :attachments
.modal-footer
.actions
%button.btn.btn-default{"data-dismiss" => "modal", :type => "button"} Close
= f.submit 'Save', class: 'btn btn-warning'
/gems/cocoon-1.2.9/lib/cocoon/view_helpers.rb i.e. before new_object = create_object(f, association, force_non_association_create)
[1] pry(#<#<Class:0x0000000b46f630>>)> create_object(f, association, force_non_association_create)
ActionView::Template::Error (wrong number of arguments (2 for 1)):
1: = form_for @property, remote: true, authenticity_token: true, html: { class: "form-horizontal", multipart: true } do |f|
2: .links
3: = link_to_add_association 'Add', f, :attachments
4: .modal-footer
5: .actions
6: %button.btn.btn-default{"data-dismiss" => "modal", :type => "button"} Close
app/views/properties/_form.html.haml:3:in `block in _app_views_properties__form_html_haml___4571956341154479101_90407280'
from /home/dev05/.rvm/gems/ruby-2.2.2@me_backend/gems/activerecord-4.2.5.1/lib/active_record/attribute_methods/query.rb:35:in `attribute?'
I have models
class Property < ActiveRecord::Base
has_many :attachments, as: :attached_item, dependent: :destroy
accepts_nested_attributes_for :attachments,allow_destroy: true
end
class Attachment < ActiveRecord::Base
belongs_to :attached_item, polymorphic: true
end
Gem versions
rails version '4.2.5.1'
ruby version '2.2.2'
cocoon (1.2.9)
Gemfile.lock file snapshot
activerecord (4.2.5.1)
activemodel (= 4.2.5.1)
activesupport (= 4.2.5.1)
arel (~> 6.0) rails (4.2.5.1)
actionmailer (= 4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
activemodel (= 4.2.5.1)
activerecord (= 4.2.5.1)
activesupport (= 4.2.5.1)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.1)
sprockets-rails
Can someone please help me to identify that what is causing issue to not creating the attachment.